首页 > 解决方案 > 如何从 firestore 中的 Stream 中的 snapshot.docs 中改组列表的顺序

问题描述

这是我从 Firestore 检索用户数据的代码:

StreamBuilder(
      stream: FirebaseFirestore.instance.collection('Consultant').snapshots(),
      builder: (context, snapshot) {
        if (!snapshot.hasData)
          return Center(child: CircularProgressIndicator());
          return ListView.builder(
            padding: EdgeInsets.fromLTRB(5, 5, 5, 60),
            itemCount: snapshot.data.docs.length, 
            itemBuilder: (BuildContext context, int index) {

有可能随机化列表的顺序吗?

标签: fluttergoogle-cloud-firestore

解决方案


推荐阅读