-
Notifications
You must be signed in to change notification settings - Fork 243
Description
db.dart provides an excellent, abstract means to connect Firestore documents and collections to Flutter without all the boilerplate. However, I noticed a bug when working with streams in db.dart. When creating a stream collection, such as by calling:
StreamProvider<List<Example>>.value(value: Global.exampleRef.streamData())
...inside of a MultiProvider widget, you will get the following error message:
An exception was thrown by _MapStrean<QuerySnapshot, List> listened by StreamProvider<List>, but no 'catchError was provided.
Exception: type 'MappedListIterable<DocumentSnapshot, Example>' is not a subtype of type 'List'
In db.dart, Line 47 is missing a .toList() at the end:
Stream<List<T>> streamData() { return ref.snapshots().map((list) => list.documents.map((doc) => Global.models[T](doc.data) as T).toList()); }