728x90
반응형
import 'dart:io';
import 'dart:async';
void download() {
for (int i = 0; i < 5; i++) {
sleep(Duration(seconds: 1));
print("download함수 : ${i}");
}
}
main() {
//독립적인 스레드
//isolate.spawn(download, "헬로우");
for (int i = 0; i < 5; i++) {
sleep(Duration(seconds: 1));
print("main함수 : ${i}");
}
}
출처: 메타코딩
728x90
반응형
'Flutter(dart)' 카테고리의 다른 글
| 플러터 함수 동시 실행 (0) | 2022.11.15 |
|---|---|
| flutter 함수 동시 실행 isolate 쓰레드 예제 (0) | 2022.11.15 |
| Could not find a file named "pubspec.yaml" (0) | 2022.11.09 |
| 플러터 build 터미널 명령어 (0) | 2022.11.07 |
| State 패턴 (0) | 2022.11.06 |