I m implementing a search feature using Flutter Search Delegate and the data is stored in Firestore. I can't figure out why this error is coming up.
Widget buildSuggestions(BuildContext context) {
return StreamBuilder(
stream: Firestore.instance.collection('todos').snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) return new Text('Loading...');
final results =
snapshot.data.documents.where((a) => a['title'].contains(query));
return ListView(
children: results.map<Widget>((a) => Text(a['title'])).toList(),
);
},
);
}
Error:
type '(dynamic) => dynamic' is not a subtype of type '(DocumentSnapshot) => bool' of 'test'