try cath in flutter code example
Example: flutter future return error
// Catch it with catchError()
return Future.error("This is the error", StackTrace.fromString("This is its trace"));
// Catch it with catchError()
return Future.error("This is the error", StackTrace.fromString("This is its trace"));