Skip to content

Commit

Permalink
Merge pull request #1 from PauloniaAQP/dev
Browse files Browse the repository at this point in the history
New release version 0.3.1
  • Loading branch information
ChrisChV authored Sep 18, 2021
2 parents 84572a2 + 757bd42 commit 2699e3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.3.1]

- Fix some bugs with null values

## [0.3.0]

- Dependencies updated
Expand Down
23 changes: 11 additions & 12 deletions lib/PauloniaRepository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ abstract class PauloniaRepository<Id, Model extends PauloniaModel<Id>>
}
Query query =
collectionReference!.where(FieldPath.documentId, isEqualTo: id);
QuerySnapshot queryRes =
await (PauloniaDocumentService.runQuery(query, cache)
as FutureOr<QuerySnapshot>);
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]);
Expand Down Expand Up @@ -114,8 +113,7 @@ abstract class PauloniaRepository<Id, Model extends PauloniaModel<Id>>
_idList = idList;
List<Model> newModels = [];
if (_idList.length <= PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT) {
newModels.addAll(await (_getFromIdList(_idList, cache: cache)
as FutureOr<Iterable<Model>>));
newModels.addAll((await _getFromIdList(_idList, cache: cache)) ?? []);
addInRepository(newModels);
if (_idList.isNotEmpty && notify)
update(RepoUpdateType.get, ids: _idList);
Expand All @@ -127,9 +125,10 @@ abstract class PauloniaRepository<Id, Model extends PauloniaModel<Id>>
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<Iterable<Model>>));
newModels.addAll((await _getFromIdList(
_idList.getRange(start, end).toList(),
cache: cache)) ??
[]);
start = end;
end += PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT;
}
Expand Down Expand Up @@ -236,9 +235,9 @@ abstract class PauloniaRepository<Id, Model extends PauloniaModel<Id>>
Query query = collectionReference!
.where(FieldPath.documentId, whereIn: idList)
.limit(PauloniaRepoConstants.ARRAY_QUERIES_ITEM_LIMIT);
QuerySnapshot queryRes =
await (PauloniaDocumentService.runQuery(query, cache)
as FutureOr<QuerySnapshot>);
QuerySnapshot? queryRes =
await PauloniaDocumentService.runQuery(query, cache);
if (queryRes == null) return [];
return getFromDocSnapList(queryRes.docs);
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down

0 comments on commit 2699e3c

Please sign in to comment.