I am trying to get the snapshot of members from my fbbackend but suddenly I get this error. type 'Null' is not a subtype of type 'Widget' code:
ListView.builder(
itemCount: null,
shrinkWrap: true,
itemBuilder: (context, index) {
if (snapshot1.hasData) {
//what ever you want
String val = snapshot1.data?.get('members')[index];
//HERE(In front of [index])
//RangeError (RangeError (index): Invalid value: Not in inclusive range 0..1: 2)
return Text(val);
} else {
return const LoadingScreen();
}
},
),
What should I do to fix this?
