Skip to content

Commit

Permalink
[fix] custom permission on stream single
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano-Trinca committed Apr 16, 2024
1 parent 0a17e48 commit 3216f0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To use this package, add the following dependency to your project's `pubspec.yam
repository_interface:
git:
url: https://github.com/Stefano-Trinca/repository_interface.git
ref: 0.0.1
ref: 0.0.2
```
## Usage Example
Expand Down
5 changes: 2 additions & 3 deletions lib/src/repository_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ typedef FromMap<E> = E Function(Map<String, dynamic> data, String? key);
typedef ToMap<E> = Map<String, dynamic> Function(E e);
typedef CheckPermission = bool Function();


/// An abstract class that defines a document-based repository interface.
///
/// This interface is intended to be used with a data model (`E`) and a key type (`SK`),
Expand Down Expand Up @@ -324,7 +323,7 @@ abstract class RepositoryCollectionInterface<E, LK, SK, BK> with BehaviorListMix
return const Stream.empty();
}
try {
return streamAll(listKey: listKey).map((l) =>
return streamAll(listKey: listKey, customPermission: customPermission).map((l) =>
l.firstWhere((e) => _config.hasKey(e, singleKey), orElse: () => _config.emptyObject));
} catch (e) {
AppLog.error('$e', repositoryName, 'streamSingle');
Expand Down Expand Up @@ -451,7 +450,7 @@ abstract class RepositoryCollectionInterface<E, LK, SK, BK> with BehaviorListMix
return _config.emptyObject;
}
try {
return cacheAll(listKey: listKey)
return cacheAll(listKey: listKey, customPermission: customPermission)
.firstWhere((e) => _config.hasKey(e, singleKey), orElse: () => _config.emptyObject);
} catch (e) {
AppLog.error('$e', repositoryName, 'cacheSingle');
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: repository_interface
description: "A new Flutter package project."
version: 0.0.1
description: "Flutter repository interface package"
version: 0.0.2
homepage:

environment:
Expand Down

0 comments on commit 3216f0b

Please sign in to comment.