refactor: Make eventupdate null safe

This commit is contained in:
Christian Pauly 2021-08-19 09:14:04 +02:00
parent d75b27a0cd
commit 5eb2d22207
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,3 @@
// @dart=2.9
/*
* Famedly Matrix SDK
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
@ -46,7 +45,12 @@ class EventUpdate {
// the order where to stort this event
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 {
if (content['type'] != EventTypes.Encrypted ||

View File

@ -56,6 +56,7 @@ EventUpdate getLastSentEvent(KeyVerification req) {
},
type: EventUpdateType.timeline,
roomID: req.room.id,
sortOrder: DateTime.now().millisecondsSinceEpoch.toDouble(),
);
}
@ -461,6 +462,7 @@ void main() {
},
type: EventUpdateType.timeline,
roomID: req2.room.id,
sortOrder: DateTime.now().millisecondsSinceEpoch.toDouble(),
));
expect(req2.state, KeyVerificationState.error);