요약
플러그인이 제대로 설치되어 있으면, 코드 저장만 해도 hot reload가 잘 동작한다
앱 state 초기화가 필요한 경우, 변경하는 사항이 build() 메서드 밖에 있는 경우에는 hot restart를 사용하자
코드 수정 내역 반영이 안 되면, hot reload > hot restart > full restart 순으로 해보자
정리
명령어
# flutter run
...
Flutter run key commands.
r Hot reload.
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
* hot reload, hot restart, full restart
hot reload
소스 코드를 실행 중인 dart vm(virtual machine)에 삽입해서 작동
vm이 새 버전의 필드와 함수로 클래스를 업데이트 한 후, 위젯 트리를 자동으로 재빌드
(web은 아직 지원하지 않음)
hot restart
hot reload에 추가로 앱 state가 초기화 됨
full restart
코드 재컴파일 후, 앱을 재시작 함
* hot reload 특수 상황 (동작하지 않거나 오동작하는 경우)
앱이 종료 된 경우
수정한 코드에 컴파일 오류가 발생 한 경우
CupertinoTabView (요놈은 수정 중)
enum을 class로, class를 enum으로 변경 한 경우
font 를 변경 한 경우 (대부분 asset은 지원하나 font는 지원 안 함. hot restart가 필요함)
generic을 변경 한 경우
네이티브 코드를 변경 한 경우
전역변수 또는 static변수를 변경 한 경우
main() 또는 initState()를 메서드를 변경 한 경우
링크
'dart' 카테고리의 다른 글
flutter 사이드 프로젝트 완료! (0) | 2022.01.29 |
---|---|
Life of a Widget?! | Decoding Flutter (0) | 2021.05.16 |
Introducing Decoding Flutter (0) | 2021.05.16 |
dart, flutter(+a) vscode 플러그인 (0) | 2021.05.16 |
flutter launcher icon (0) | 2021.05.10 |