Flutter won't return boolean in async await method

104 Views Asked by At

I need to check my file reading was successful and return true or false. I need to use async and await function because it needs to return true otherwise no point continuing.

I get a run time error from my snapshot: format.Exception:Invalid boolean false

Offending line is: bool result = await fb.readFile();

enter image description here

More detail image:

enter image description here

1

There are 1 best solutions below

0
CURRO On

You dont have a return, maybe something like this:

Future<bool> boolFuture()async{
await Future.delayed(Duration(seconds: 1));
return false;
}

Good luck