diff --git a/lib/src/database/hive_collections_database.dart b/lib/src/database/hive_collections_database.dart index 19a4b8f4..80fa1597 100644 --- a/lib/src/database/hive_collections_database.dart +++ b/lib/src/database/hive_collections_database.dart @@ -386,8 +386,8 @@ class HiveCollectionsDatabase extends DatabaseApi { runBenchmarked>('Get event list', () async { // Get the synced event IDs from the store final timelineKey = TupleKey(room.id, '').toString(); - final timelineEventIds = - (await _timelineFragmentsBox.get(timelineKey) ?? []); + final timelineEventIds = List.from( + (await _timelineFragmentsBox.get(timelineKey)) ?? []); // Get the local stored SENDING events from the store late final List sendingEventIds; @@ -395,10 +395,8 @@ class HiveCollectionsDatabase extends DatabaseApi { sendingEventIds = []; } else { final sendingTimelineKey = TupleKey(room.id, 'SENDING').toString(); - sendingEventIds = - (await _timelineFragmentsBox.get(sendingTimelineKey) ?? []) - .whereType() - .toList(); + sendingEventIds = List.from( + (await _timelineFragmentsBox.get(sendingTimelineKey)) ?? []); } // Combine those two lists while respecting the start and limit parameters. @@ -425,9 +423,8 @@ class HiveCollectionsDatabase extends DatabaseApi { runBenchmarked>('Get event id list', () async { // Get the synced event IDs from the store final timelineKey = TupleKey(room.id, '').toString(); - final timelineEventIds = - (await _timelineFragmentsBox.get(timelineKey) as List? ?? - []); + final timelineEventIds = List.from( + (await _timelineFragmentsBox.get(timelineKey)) ?? []); // Get the local stored SENDING events from the store late final List sendingEventIds; @@ -435,9 +432,8 @@ class HiveCollectionsDatabase extends DatabaseApi { sendingEventIds = []; } else { final sendingTimelineKey = TupleKey(room.id, 'SENDING').toString(); - sendingEventIds = (await _timelineFragmentsBox.get(sendingTimelineKey) - as List? ?? - []); + sendingEventIds = List.from( + (await _timelineFragmentsBox.get(sendingTimelineKey)) ?? []); } // Combine those two lists while respecting the start and limit parameters. diff --git a/lib/src/database/hive_database.dart b/lib/src/database/hive_database.dart index 8ec9d581..240b6a8d 100644 --- a/lib/src/database/hive_database.dart +++ b/lib/src/database/hive_database.dart @@ -393,18 +393,16 @@ class FamedlySdkHiveDatabase extends DatabaseApi { runBenchmarked>('Get event list', () async { // Get the synced event IDs from the store final timelineKey = MultiKey(room.id, '').toString(); - final timelineEventIds = - (await _timelineFragmentsBox.get(timelineKey) as List? ?? []); - + final timelineEventIds = List.from( + (await _timelineFragmentsBox.get(timelineKey)) ?? []); // Get the local stored SENDING events from the store late final List sendingEventIds; if (start != 0) { sendingEventIds = []; } else { final sendingTimelineKey = MultiKey(room.id, 'SENDING').toString(); - sendingEventIds = - (await _timelineFragmentsBox.get(sendingTimelineKey) as List? ?? - []); + sendingEventIds = List.from( + (await _timelineFragmentsBox.get(sendingTimelineKey)) ?? []); } // Combine those two lists while respecting the start and limit parameters. @@ -428,9 +426,9 @@ class FamedlySdkHiveDatabase extends DatabaseApi { runBenchmarked>('Get event id list', () async { // Get the synced event IDs from the store final timelineKey = MultiKey(room.id, '').toString(); - final timelineEventIds = - (await _timelineFragmentsBox.get(timelineKey) as List? ?? - []); + + final timelineEventIds = List.from( + (await _timelineFragmentsBox.get(timelineKey)) ?? []); // Get the local stored SENDING events from the store late final List sendingEventIds; @@ -438,9 +436,8 @@ class FamedlySdkHiveDatabase extends DatabaseApi { sendingEventIds = []; } else { final sendingTimelineKey = MultiKey(room.id, 'SENDING').toString(); - sendingEventIds = (await _timelineFragmentsBox.get(sendingTimelineKey) - as List? ?? - []); + sendingEventIds = List.from( + (await _timelineFragmentsBox.get(sendingTimelineKey)) ?? []); } // Combine those two lists while respecting the start and limit parameters.