I have a function witch returns a Future.
main(){
function().timeout(Duration(milliseconds: 100), onTimeout: () {
print("exit function");
});
}
Future<void>function()async{
await Future.delay(Duration(milliseconds: 500);
print("function was run");
return Future.value(null);
}
I want to exit the function after the timeout.
In the example above i expect the output exit function
.
How ever, the output from the flutter console is:
exit function
function was run
Does anybody know how to generete my expected result?
- function can be of any type.
Thanks for ur help