Flutter version: 2.0.5
Write it when you have time, fill in the pit slowly
Some functions can improve development efficiency, it is recommended to see
flutter clean # 5 5 5 5 5 5 cache
flutter pub get # 6 6 dependencies
Migration Guide
To ensure that the library you use also supports air safety
# automatic upgrade
dart migrate --apply-changes
In the environment of the web browser, you cannot use Platform to determine whether to determine whether it is Kisweb for the web
import 'dart:io';
import 'package:flutter/foundation.dart';
class DeviceType {
static bool isWeb = kIsWeb;
static bool isIOS = !isWeb && Platform.isIOS;
static bool isAndroid = !isWeb && Platform.isAndroid;
static bool isMacOS = !isWeb && Platform.isMacOS;
static bool isLinux = !isWeb && Platform.isLinux;
static bool isWindows = !isWeb && Platform.isWindows;
static bool get isDesktop => isWindows || isMacOS || isLinux;
static bool get isMobile => isAndroid || isIOS;
static bool get isDesktopOrWeb => isDesktop || isWeb;
static bool get isMobileOrWeb => isMobile || isWeb;
}
# Different APKs for ARM and ARM64 to reduce the size of the APK
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
# Installation
adb install .\build\app\outputs\flutter-apk\app-arm64-v8a-release.apk
1 When writing native code, you must first run in Android Studio, let Cocoapods generate project files, and then open it with Xcode, otherwise you cannot see the native Plugin file in the directory.
flutter config --enable-web
## Create a web template in the root directory of the existing project
flutter create .
flutter run -d chrome
web packaging can choose two rendering modes, the PC side corresponds to Canvaskit, and the mobile terminal corresponds to HTML
# Generate files in BUILD/Web
# mobile terminal optimization
flutter build web --web-renderer html
# PC -end optimization
flutter build web --web-renderer canvaskit
Need Python environment support
python -m http.server 80 --directory .\build\web\
flutter config --enable-windows-desktop
## Create Windows template in the root directory of existing projects
flutter create .
flutter run -d windows
# generate files in Build/Windows/Runner/Release
flutter build windows