flutter future
// Step 1: Set the variable in future<void>
// Step 2: Make sure to use the variable on
// async void who await the future
String? test;
Future<void> fetchUserOrder() {
// Imagine that this function is fetching user info from another service or database.
return Future.delayed(const Duration(seconds: 1), () => test = "Large Latte");
}
void main() async {
await fetchUserOrder();
print('Fetching user order... $test');
}