I’m getting weird error,
The argument type 'UserData' can`t be assigned to the parameter type 'UserData?'
I think assigning ‘UserData?’ to ‘UserData’ is unsafe but, its obvious that I have definitely defined value. How can I add undefinition to make my user data to be accepted by the dart?
2
Answers
Use the null assertion operator ! when you’re sure that the value is not null:
Just pass null assertion operator
!
with object:Make sure to check the object is not
null
while adding null assertion operator.