Skip to content

Commit 7ecbf41

Browse files
authored
Update README.md
1 parent c11ecc9 commit 7ecbf41

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class Entity {
5050
factory Entity.fromJson(Map<String, dynamic> map) {
5151
return Entity(...);
5252
}
53+
54+
factory Entity.default() {
55+
return Entity(...);
56+
}
5357
}
5458
5559
// Emits a single row, doesn't emit if the row dosen't exist, emit error if more than 1 row in result set
@@ -66,7 +70,7 @@ final Observable<Entity> singleOrDefaultQuery$ = briteDb.createQuery(
6670
where: 'id = ?',
6771
whereArgs: [id],
6872
limit: 1,
69-
).mapToOneOrDefault((row) => Entity.fromJson(row));
73+
).mapToOneOrDefault((row) => Entity.fromJson(row), Entity.default());
7074
7175
// Emits a list of rows.
7276
final Observable<List<Entity>> listQuery$ = briteDb.createQuery(

0 commit comments

Comments
 (0)