Flutter web & Firebase : "Unexpected null value" #6619
Unanswered
vesperadlaw
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there !
I code an App and a Website with Flutter and Firebase (both have same data base and similar design and widgets).
Here's my issue: a part of my code to display datas works perfectly on the App but not on the Website, it's return an error: Unexpected null value.
I searched everywhere, I did not find anything to fix it. If somebody have an idea why this is not working on Chrome localhost...
This is my code :
FutureBuilder<QuerySnapshot>( future: products.get(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done) { return ListView( children: snapshot.data!.docs.map((document) { return Container( child: Column( children: [ Text('${document['Brand']}'), Text('${document['Name']}'), Text('${document['Price']}'), ], ), ); }).toList(), ); } else { return CircularProgressIndicator(); } } ),
This is my debug console :
I think the error comes from "snapshot.data!.docs()" but I do not know how to fix it and I don't get why it's perfectly working on my App but not on my Website with Flutter web... Somebody have an idea to fix my issue ?
Sorry I'm new, I actually don't know how to put my code nicely...
Beta Was this translation helpful? Give feedback.
All reactions