[Flutter] Dart 문법 (async, Future, await, then)


[Flutter] Dart 문법 (async, Future, await, then)

* 비동기 - 아래 printWithDelay함수에서 await를 빼고 실행시키면 Future.delayed와 print가 동시에 실행되는 듯 하고, await을 넣고 실행시키면 delay가 적용된 후에 print가 실행된다. //Future : An object representing a delayed computation. //async : async 함수 본문 앞에 키워드 사용하여 비동기로 표시 //await : async 내에서 작동하는 기능. Future printWithDelay(Duration delay, String message) async { await Future.delayed(delay); print(message); } Future printWithDelay2() async { v..


원문링크 : [Flutter] Dart 문법 (async, Future, await, then)