Answers for "search delegate flutter firestore"

0

use search delegate flutter firebase

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(),
      );
    },
  );
}
Posted by: Guest on February-10-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language