Skip to content

Commit

Permalink
step-30
Browse files Browse the repository at this point in the history
  • Loading branch information
vandadnp committed Jan 14, 2022
1 parent 3592cce commit e99ffff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
25 changes: 6 additions & 19 deletions lib/services/cloud/firebase_cloud_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,12 @@ class FirebaseCloudStorage {
}
}

Stream<Iterable<CloudNote>> allNotes({required String ownerUserId}) =>
notes.snapshots().map((event) => event.docs
.map((doc) => CloudNote.fromSnapshot(doc))
.where((note) => note.ownerUserId == ownerUserId));

Future<Iterable<CloudNote>> getNotes({required String ownerUserId}) async {
try {
return await notes
.where(
ownerUserIdFieldName,
isEqualTo: ownerUserId,
)
.get()
.then(
(value) => value.docs.map((doc) => CloudNote.fromSnapshot(doc)),
);
} catch (e) {
throw CouldNotGetAllNotesException();
}
Stream<Iterable<CloudNote>> allNotes({required String ownerUserId}) {
final allNotes = notes
.where(ownerUserIdFieldName, isEqualTo: ownerUserId)
.snapshots()
.map((event) => event.docs.map((doc) => CloudNote.fromSnapshot(doc)));
return allNotes;
}

Future<CloudNote> createNewNote({required String ownerUserId}) async {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
version: 1.1.0+1

environment:
sdk: ">=2.15.0 <3.0.0"
Expand Down

0 comments on commit e99ffff

Please sign in to comment.