refactor: Make eventupdate null safe
This commit is contained in:
parent
d75b27a0cd
commit
5eb2d22207
|
|
@ -1,4 +1,3 @@
|
||||||
// @dart=2.9
|
|
||||||
/*
|
/*
|
||||||
* Famedly Matrix SDK
|
* Famedly Matrix SDK
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -46,7 +45,12 @@ class EventUpdate {
|
||||||
// the order where to stort this event
|
// the order where to stort this event
|
||||||
final double sortOrder;
|
final double sortOrder;
|
||||||
|
|
||||||
EventUpdate({this.roomID, this.type, this.content, this.sortOrder});
|
EventUpdate({
|
||||||
|
required this.roomID,
|
||||||
|
required this.type,
|
||||||
|
required this.content,
|
||||||
|
required this.sortOrder,
|
||||||
|
});
|
||||||
|
|
||||||
Future<EventUpdate> decrypt(Room room, {bool store = false}) async {
|
Future<EventUpdate> decrypt(Room room, {bool store = false}) async {
|
||||||
if (content['type'] != EventTypes.Encrypted ||
|
if (content['type'] != EventTypes.Encrypted ||
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ EventUpdate getLastSentEvent(KeyVerification req) {
|
||||||
},
|
},
|
||||||
type: EventUpdateType.timeline,
|
type: EventUpdateType.timeline,
|
||||||
roomID: req.room.id,
|
roomID: req.room.id,
|
||||||
|
sortOrder: DateTime.now().millisecondsSinceEpoch.toDouble(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,6 +462,7 @@ void main() {
|
||||||
},
|
},
|
||||||
type: EventUpdateType.timeline,
|
type: EventUpdateType.timeline,
|
||||||
roomID: req2.room.id,
|
roomID: req2.room.id,
|
||||||
|
sortOrder: DateTime.now().millisecondsSinceEpoch.toDouble(),
|
||||||
));
|
));
|
||||||
expect(req2.state, KeyVerificationState.error);
|
expect(req2.state, KeyVerificationState.error);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue