Closed Davepn16 closed 1 year ago
Thanks for the tip!
not solved
open issue please @RivaanRanawat
I think we have to check the photoUrl null or not before. solved but not sure
backgroundImage: NetworkImage(
(snapshot.data! as dynamic)
.docs[index]
.data()["photoUrl"] ??
imageUrl),
),
This worked for me thanks for the tip!
If you get "StateError (Bad state: field does not exist within the DocumentSnapshotPlatform)" on search screen at :
(snapshot.data! as dynamic).docs[index] ['photoUrl'],
you should use:
if (snapshot.connectionState == ConnectionState.waiting)
instead of :
if (!snapshot.hasData)
It looks like hasdata returns true for any non-null data, and [] is non-null data, hence hasdata will return true while the snapshot is still in a waiting state.
Always use ConnectionState.waiting, never use junky hasdata which actually means "not null".
Thanks for the tip this added to the success!
If you get "StateError (Bad state: field does not exist within the DocumentSnapshotPlatform)" on search screen at :
you should use:
if (snapshot.connectionState == ConnectionState.waiting)
instead of :
if (!snapshot.hasData)
It looks like hasdata returns true for any non-null data, and [] is non-null data, hence hasdata will return true while the snapshot is still in a waiting state.
Always use ConnectionState.waiting, never use junky hasdata which actually means "not null".