FlutterFire - Basics of FirestoreListView
1 min read

FlutterFire - Basics of FirestoreListView

FirestoreListView is a mix of firestore and ListView, and as such it needs a firestore query and an item builder to create an essential list.

final usersQuery = FirebaseFirestore.instance.collection('users').orderBy('name');

FirestoreListView<Map<String, dynamic>>(
  query: usersQuery,
  itemBuilder: (context, snapshot) {
    Map<String, dynamic> user = snapshot.data();

    return Text('User name is ${user['name']}');

Raw firestore data in the form of Map<String, dynamic> is available through the snapshot parameter inside the itemBuilder function. This raw data could be parsed and transferred to our custom model through a convertor.