title: Randomize/shuffle order of Firestore stream in Flutter/Dart?
body: <p>I'm creating an app that makes use of a stream builder, pulling data from Firestore cloud. Here is the code:</p>
  
  <pre><code>return Scaffold(
    backgroundColor: Colors.black,
    appBar: appBar,
    drawer: Sidebar(),
    body: Center(
      child: StreamBuilder(
        stream: stream,
        builder: (context, snapshot) {
          if (!snapshot.hasData) {
            return Text(
              "Loading...",
              style: TextStyle(
                color: Colors.white,
              ),
            );
          } else {
            return GridView.builder(
              itemCount: snapshot.data.documents.length,
              shrinkWrap: true,
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: globals.gridCountValue != null ? globals.gridCountValue : 2,
              ),
              itemBuilder: (context, index) {
                return _buildList(context, snapshot.data.documents[index]);
              },
            );
          }
        },
      ),
    ),
    floatingActionButton: FloatingActionButton(
      // onPressed: () =&gt; shuffleAlbums(),
      onPressed: () {},
      child: Icon(Icons.shuffle),
      elevation: 2,
      backgroundColor: Colors.black,
    ),
    floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
  );
  </code></pre>
  
  <p>_buildList:</p>
  
  <pre><code>  Widget _buildList(BuildContext context, DocumentSnapshot document) {
      if (document.data != null) {
        return new AlbumTile(data: document.data);
      }
    }
  </code></pre>
  
  <p>I was able to shuffle the order of the list when I was using a hard-coded list of albums, but now that I'm using a stream builder, I don't know how to reach that result. I basically want to re-order the list in a random order, on the press of a button.</p>
  
  <p>Thank you for reading!</p>