Thee error message is pretty explicit: the function returns a nullable value -
bool?
- and you are trying to store it in a non-nullable type -
bool
; the types are not the same.
The simplest solutions are to change the type of
yes
to
bool?
, or change the return value of
dialogConfirmation
to
bool
There are other ways, but they are more complicated:
https://stackoverflow.com/questions/67246851/in-dart-given-the-nullable-type-t-how-do-i-get-the-non-nullable-one-t[
^]