diff --git a/mobile/lib/models/collection/collection.dart b/mobile/lib/models/collection/collection.dart index c62c9432d5..c2186a199b 100644 --- a/mobile/lib/models/collection/collection.dart +++ b/mobile/lib/models/collection/collection.dart @@ -225,8 +225,8 @@ class Collection { return result; } - static fromMap(Map? map) { - if (map == null) return null; + static Collection fromMap(Map map) { + final sharees = (map['sharees'] == null || map['sharees'].length == 0) ? [] : List.from(map['sharees'].map((x) => User.fromMap(x))); diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart index 9db347d92a..fd4df26e6f 100644 --- a/mobile/lib/services/collections_service.dart +++ b/mobile/lib/services/collections_service.dart @@ -1202,10 +1202,10 @@ class CollectionsService { } Future _fromRemoteCollection( - Map? collectionData, + Map collectionData, ) async { final Collection collection = Collection.fromMap(collectionData); - if (collectionData != null && !collection.isDeleted) { + if (!collection.isDeleted) { final collectionKey = _getAndCacheDecryptedKey(collection, source: "fetchDecryptMeta"); if (collectionData['magicMetadata'] != null) { @@ -1900,9 +1900,9 @@ class CollectionsService { String _decryptCollectionPath(Collection collection) { final existingPath = collection.decryptedPath; - if (existingPath != null && existingPath!.isNotEmpty) { + if (existingPath != null && existingPath.isNotEmpty) { debugPrint("Using cached decrypted path for collection ${collection.id}"); - return existingPath!; + return existingPath; } else { debugPrint( "Decrypting path for collection ${collection.id} from "