반응형
import 'dart:async';
Future<int> future100(){
return Future<int>.delayed(Duration(seconds:1), (){
return 100;
});
}
Future<int> futureAdd100(value){
return Future<int>.delayed(Duration(seconds: 1), (){
return value +100;
});
}
void main(List<String> args){
future100()
.then((value){
return futureAdd100(value);
})
.then((value){
print(value);
});
}
import 'dart:async';
Future<int> future100(){
return Future<int>.delayed(Duration(seconds:1), (){
return 100;
});
}
Future<int> futureAdd100(value){
return Future<int>.delayed(Duration(seconds: 1), (){
return value +100;
});
}
void main(List<String> args){
future100()
.then((value){
return futureAdd100(value);
})
.then((value){
print(value);
});
}
'flutter' 카테고리의 다른 글
bloc timer (0) | 2021.09.30 |
---|---|
dart generator (0) | 2021.09.09 |
Provider 예제 (0) | 2021.04.08 |
dart functor (0) | 2020.12.28 |
flutter - firebase 로그인, 로그아웃 (0) | 2020.12.21 |