Trying to pass null in a list.add(null) call but unable to do this since migrating to the null safety update.
this is the error on bloc
this is the model
I have tried adding ?. to the List but having no luck in fixing this.
Trying to pass null in a list.add(null) call but unable to do this since migrating to the null safety update.
this is the error on bloc
this is the model
I have tried adding ?. to the List but having no luck in fixing this.
3
Answers
You need to change 1 line in your model class…
TO
Add question mark after ProductCategory will make that list item nullable.
try to make your list like this
You need to make
StreamController
‘s dataType nullable, to add null.Find more about understanding-null-safety.