I have a StreamBuilder to get snapShot from my FB backend as an list. But I am trying to remove the first element from that list How can I do that?
code:
StreamBuilder<DocumentSnapshot?>(
stream: FirebaseFirestore.instance
.collection("users")
.doc(userUid)
.snapshots(),
builder: (context, snapshot) {
//SnapShot
var rooms = snapshot.data?['room'];
List<dynamic> room = rooms;
return...
//Action to remove 0
ElevatedButton(
onPressed: () async => {
//Remove the first string in this array
room.removeAt(0)},
child: const Text('Remove first element from array'),
),
Error: type 'Null' is not a subtype of type 'List<dynamic>'