diff --git a/CHANGELOG.md b/CHANGELOG.md index 5704c4d..be5a38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.3.1] + +- Fix some bugs with null values + ## [0.3.0] - Dependencies updated diff --git a/lib/PauloniaRepository.dart b/lib/PauloniaRepository.dart index 1cd680d..b165b3a 100644 --- a/lib/PauloniaRepository.dart +++ b/lib/PauloniaRepository.dart @@ -71,10 +71,9 @@ abstract class PauloniaRepository> } Query query = collectionReference!.where(FieldPath.documentId, isEqualTo: id); - QuerySnapshot queryRes = - await (PauloniaDocumentService.runQuery(query, cache) - as FutureOr); - if (queryRes.docs.isEmpty) return null; + QuerySnapshot? queryRes = + await PauloniaDocumentService.runQuery(query, cache); + if (queryRes == null || queryRes.docs.isEmpty) return null; Model res = (await getFromDocSnapList(queryRes.docs)).first; repositoryMap[id] = res; if (notify) update(RepoUpdateType.get, ids: [id]); @@ -114,8 +113,7 @@ abstract class PauloniaRepository> _idList = idList; List newModels = []; if (_idList.length <= PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT) { - newModels.addAll(await (_getFromIdList(_idList, cache: cache) - as FutureOr>)); + newModels.addAll((await _getFromIdList(_idList, cache: cache)) ?? []); addInRepository(newModels); if (_idList.isNotEmpty && notify) update(RepoUpdateType.get, ids: _idList); @@ -127,9 +125,10 @@ abstract class PauloniaRepository> while (true) { if (end > _idList.length) end = _idList.length; if (end == start) break; - newModels.addAll(await (_getFromIdList( - _idList.getRange(start, end).toList(), - cache: cache) as FutureOr>)); + newModels.addAll((await _getFromIdList( + _idList.getRange(start, end).toList(), + cache: cache)) ?? + []); start = end; end += PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT; } @@ -236,9 +235,9 @@ abstract class PauloniaRepository> Query query = collectionReference! .where(FieldPath.documentId, whereIn: idList) .limit(PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT); - QuerySnapshot queryRes = - await (PauloniaDocumentService.runQuery(query, cache) - as FutureOr); + QuerySnapshot? queryRes = + await PauloniaDocumentService.runQuery(query, cache); + if (queryRes == null) return []; return getFromDocSnapList(queryRes.docs); } diff --git a/pubspec.yaml b/pubspec.yaml index f9658c8..21552aa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: paulonia_repository description: Package with abstract class for create Models and Repositories -version: 0.3.0 +version: 0.3.1 homepage: https://paulonia.dev repository: https://github.com/PauloniaAQP/paulonia_repository @@ -11,7 +11,7 @@ environment: dependencies: flutter: sdk: flutter - get: ^4.1.4 + get: ^4.3.8 cloud_firestore: ^1.0.7 paulonia_document_service: ^0.2.0