From 5eb2d222071202123e714919506fc273fc3b6866 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 19 Aug 2021 09:14:04 +0200 Subject: [PATCH] refactor: Make eventupdate null safe --- lib/src/utils/event_update.dart | 8 ++++++-- test/encryption/key_verification_test.dart | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/utils/event_update.dart b/lib/src/utils/event_update.dart index 67af4e13..fe0d1877 100644 --- a/lib/src/utils/event_update.dart +++ b/lib/src/utils/event_update.dart @@ -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 decrypt(Room room, {bool store = false}) async { if (content['type'] != EventTypes.Encrypted || diff --git a/test/encryption/key_verification_test.dart b/test/encryption/key_verification_test.dart index b4d7e242..d4d71396 100644 --- a/test/encryption/key_verification_test.dart +++ b/test/encryption/key_verification_test.dart @@ -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);