Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- Redux
- 유령 의존성
- JS
- git
- NVM
- Til
- lgcns camp
- 원티드인턴십
- 원티트 프리온보딩인턴십 1주차
- Client-Side Navigation
- react
- 원티드프리온보딩
- 알고리즘
- 프로젝트
- JavaScript
- Passed by Value
- 식별자란
- CloudFront 무효화
- jsEvent Loop
- 회고록
- NextJs
- next/link
- CPU와 GPU의 차이점
- Node
- react portal
- 광고지구
- lg cns am inspire camp
- Mac OS NVM
- lg cns am inspire camp 2기
- 향해99
Archives
- Today
- Total
SUIN
[Dart] Dart 비동기 본문
728x90
async / await / Future : 1회만 응답을 돌려받는경우 , 서버에서 응답을 받아오는경우에 사용
//Future<돌려받는 타입 지정> , todo(매개변수)
Future<void> todo(int second) async{
//second 만큼 지연을 발생시킴
await Future.delayed(Duration(seconds: second));
print('Todo Done in $second seconds');
}
todo(3);
todo(1);
todo(5);
async* / yield / Stream : 지속적인 응답을 돌려받는경우 , 타이머 등 시간계산의 경우 사용
Stream<int> todo() async* {
int counter = 0;
while(countern <= 10){
counter++ ;
await Future.delayed(Duration(secounds:1));
print('Todo is Running $counter');
yield counter ;
}
print('Todo is Done');
todo().listen((event){});
}
'Flutter' 카테고리의 다른 글
| [Flutter] 플러터 기초 stateless / stateful /restart /reload/Material / Cupertino (0) | 2024.03.15 |
|---|