Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter: _TypeError (type 'Null' is not a subtype of type 'String')

Can someone help with this error? print() retrieve me the data from firebase but when I try to access them in the widegt the erros apears

error image

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

What really happened is, you’re trying to use a value, which is null, but, the Text widget is expecting a string, rather than null. This is the root cause of your error.

You can fix the error by making sure your data is not null or you can use a null safe operator on your nullable data.

Example:

Text(userData['name'] ?? 'name not found')

Happy coding 😀

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading