Flutter 디버그 모드 / 릴리즈 모드 구분하기 / 디버깅 안될때
디버그와 릴리즈 를 구분해서 다른 동작을 하고 싶을때, 아래 코드를 사용합니다.
1) 먼저 패키지를 임포트 합니다.
import 'package:flutter/foundation.dart';
2) 아래 코드를 이용해서 디버그 모드인지 릴리즈모드 인지 판단합니다.
//디버그 모드
if (kDebugMode) {
doSomething();
}
//릴리즈 모드
if (kReleaseMode) {
doSomething();
}
flutter로 바로 실행해도 디버그 모드가 아닌 릴리즈로 변경하는 방법
iOS
1) Xcode를 실행합니다.

2) 스키마 수정으로 이동합니다.
Product > Scheme > Edit Scheme...

3) Run 스키마를 debug에서 release로 변경합니다.

4) 앱 실행
Android
1) Android 폴더를 Android Studio로 엽니다.
flutter로만 프로젝트를 보다가 Android 프로젝트로 오픈하게 되면, 한참 기다려주세요..
많은 빌드 작업이 필요합니다...

2) 좌측 하단에 있는 Build Variants 탭을 클릭하고 :app Module 오른쪽에 있는 debug를 클릭해서 release로 변경합니다.

3) 앱 실행
android release 참고 링크 :
https://docs.flutter.dev/deployment/android#how-do-i-build-a-release-from-within-android-studio
안드로이드 스튜디오에서, Flutter 관련 디버깅이 안될때.
1. [File > Invalidate Caches...] 클릭
2. 팝업창에서 "Invalidate and Restart" 클릭

