Skip to content

Instantly share code, notes, and snippets.

View tahlin-notes's full-sized avatar

Tahlin tahlin-notes

View GitHub Profile
"Nice try."
@tahlin-notes
tahlin-notes / main.dart
Created November 17, 2020 06:33
Sample create Future
void main() {
// final sampleFuture = Future<T>(() {});
final sampleFuture = Future<void>(() {
print('2');
});
print('1');
}
@tahlin-notes
tahlin-notes / main.dart
Last active November 17, 2020 07:16
Sample Future chain
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');