future in flutter code example
Example 1: flutter future return error
// Catch it with catchError()
return Future.error("This is the error", StackTrace.fromString("This is its trace"));
Example 2: dart language asynchronous ??
import 'dart:async';
void main() {
final myFuture = Future(() {
print("Hello from the future!");
return true;
});
print("Done!");
}