This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Nice try." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
// final sampleFuture = Future<T>(() {}); | |
final sampleFuture = Future<void>(() { | |
print('2'); | |
}); | |
print('1'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final sampleFuture = Future<void>(() { | |
print('2'); | |
}).then((value) { | |
print('3'); | |
}).whenComplete(() { | |
// Chú ý: whenComplete này thuộc về `Future()` được trả về bởi `then()` chứ không phải thuộc về `sampleFuture` | |
print('4'); | |
}).then((value) { | |
print('5'); |