1월, 2023의 게시물 표시

[flutter] async/await

동기화/비동기화 예시 #1 const oneSecond = Duration(seconds: 1); Future<void> printWithDelay0(String message) async { await Future.delayed(oneSecond); print(message); } Future<void> printWithDelay1(String message) { Future.delayed(oneSecond) .then((_) { print(message); }); } void main() { printWithDelay0(); for (int i = 0; i < 5; i++) { print('hello ${i + 1}'); } printWithDelay1(); } 결과 #1 hello 1 hello 2 hello 3 hello 4 hello 5 First time... Second tine... 예시 #2 void main() async { await printWithDelay0(); for (int i = 0; i < 5; i++) { print('hello ${i + 1}'); } await printWithDelay1(); } 결과 #2 First time... hello 1 hello 2 hello 3 hello 4 hello 5 Second tine...

[flutter] doctor -v 오류 ("✗ Unable to find bundled Java version.")

Android Studio (version 2022.1) / "Electric Eel | 2022.1.1" 설치 후 flutter doctor 실행하면 발생하는 문제 - 오류 발동 $ flutter doctor -v - 오류 내용 [!] Android Studio (version 2022.1) ... ✗ Unable to find bundled Java version. - 해결 방법 -- Windows 1. Android Studio가 설치된 곳으로 이동 C:\> cd "C:\Program Files\Android\Android Studio") 2. Symbol link 생성 (다음 중 한가지로) 2.1 Command Line C:\Program Files\Android\Android Studio> mklink /d .\jre .\jbr 2.2 PowerShell PS C:\Program Files\Android\Android Studio> New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr -- macOS 1. Android Studio가 설치된 곳으로 이동 cd "/Application/Android Studio/Contents" 2. Symbol link 생성 $ ln -sv jbr jre - 확인 $ flutter doctor -v - 참고 -- Flutter: https://docs.flutter.dev/get-started/install/windows#run-flutter-doctor -- macOS Terminal (ln): https://www.oreilly.com/library/view/macintosh-terminal-pocket/9781449328962/re11.html -- Windows Command Line (mklink): https://learn.microsoft.com/ko-kr/