Some can help me. My message error is The property 'message' can't be unconditionally accessed because the receiver can be 'null'. Try making the access conditional (using '?.') or adding a null check to the target ('!').
Asked
Active
Viewed 582 times
1
-
Try to change from 'snapshot.data.message' to 'snapshot.data.message!' – KuKu Mar 23 '22 at 04:07
-
It is possible `snapshot.data` will be null, check if it is null, then provide `snapthshot.data?.message??"default message"` – Md. Yeasin Sheikh Mar 23 '22 at 04:07
-
Does this answer your question? ["The argument type 'String?' can't be assigned to the parameter type 'String'" when using stdin.readLineSync()](https://stackoverflow.com/questions/66695339/the-argument-type-string-cant-be-assigned-to-the-parameter-type-string-w) – Md. Yeasin Sheikh Mar 23 '22 at 04:08
1 Answers
1
If you know, snapshot.data.message
is not null
, you can do :
errorMessage: snapshot.data.message!,
If it snapshot.data.message
can be null
, a solution would be :
errorMessage: snapshot.data.message ?? '',

Valentin Vignal
- 6,151
- 2
- 33
- 73