====== Flutter ====== [[sotfware_development:dart]] ==== 설치 ==== https://docs.flutter.dev/get-started/install === windows === * 설치순서 1. git설치 2. flutter 압축풀기 3. /bin 폴더 경로 복사 4. environment variable 설정에서 PATH에 추가 5. flutter doctor 에서 설치하라는 거([x]표시) 설치하기 5.1. Visual Studio : Dektop c++, Windows 10 SDK 등등 5.2. Android toolchain : Android Studio 설치 5.2.1. 남은 두가지 : 처음 화면에서 More option > SDK Manager > 두번째 Tab SDK Tools > Android command-line tool & Intel x86.. (인텔 CPU일때) & Google USB Driver(실제 기기연결시) 5.2.2. 나오는 메시지 복사 실행 : flutter doctor --android-licenses 5.3. Window version 문제 : [[https://ktc7514.tistory.com/509|flutter upgrade]] 6. 플러그인 설치 : Android Studio 처음에서 Plugins > flutter 설치 7. New Flutter Project > Flutter > SDK path : 설치된 폴더(flutter) 8. Project 생성 후 우측 위 Device Manager > Create Device > Pixel XL (추천) * Emulator Terminated : Help>Show Log in Explorer ==== Android Studio ==== Flutter Hot reload : 지금 상태에서 업데이트 (Widget 의 build 함수 안에 있는 것만 가능) Flutter Hot restart : 처음부터 실행 class AA extends ~~~ : AA에서 alt+enter (Show Context Action) -> missing override 자동입력 우클릭 : Reformat code with 'dart format' - (,) 기준 정렬 - File > Setting > Keymap > 검색 > 단축키 설정 Show Context Action : wrap 지우기, wrap 씌우기 stless 입력 -> StatelessWidget 자동생성 stful 우클릭: Refactor -> rename => 모든 이름 변경 ==== Hello, World ==== void main() { //runApp(const MyApp()); runApp( MaterialApp( debugShowCheckedModeBanner: false, //Debug 배너 없애기 home : Scaffold( backgroundColor: Colors.black, //body: Text("hello world") body: Center( // 가운데 child: Text("Hello world", style: TextStyle( color: Colors.white, fontSize: 20.0 ) ) ) ), ), ); } ==== pubspec.yaml ==== pubspec.yaml put get 클릭 === Asset 추가 === flutter: 아래 assets: - asset/img/ (폴더명) === dependencies === https://pub.dev/ ^3.0.0 : major update(3)는 자동으로 하지 않음) ==== Packages ==== === WebView === * 추가해야 함 (배포할 때 필요) * net::ERR_CLEARTEXT_NOT_PERMITTED 에러 (https 아니거나, redirect 되는경우) - android:networkSecurityConfig="@xml/network_security_config https://stackoverflow.com/questions/55592392/how-to-fix-neterr-cleartext-not-permitted-in-flutter ※프로젝트 자체를 껐다가 다시켜야 함 {{tag>software_development 앱개발 플러터 flutter}} ~~DISCUSSION~~