Migrated llc Lists to be nullable instead of being an empty array

This commit is contained in:
Ayush Shekhar
2022-04-26 21:11:24 +05:30
parent 381e1c06f5
commit b6bb3608e5
23 changed files with 178 additions and 153 deletions
@@ -33,11 +33,13 @@ class ReadDao extends DatabaseAccessor<DriftChatDatabase> with _$ReadDaoMixin {
bulkUpdateReads({cid: readList});
/// Bulk updates the reads data of multiple channels
Future<void> bulkUpdateReads(Map<String, List<Read>> channelWithReads) {
Future<void> bulkUpdateReads(Map<String, List<Read>?> channelWithReads) {
final entities = channelWithReads.entries
.map((entry) => entry.value.map(
.map((entry) =>
entry.value?.map(
(read) => read.toEntity(cid: entry.key),
))
) ??
[])
.expand((it) => it)
.toList(growable: false);
return batch((batch) => batch.insertAllOnConflictUpdate(reads, entities));