flutter
# cache clean
dart pub cache repair
dart pub cache clean
development
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
# open a simulator
open -a Simulator
flutter devices
adb devices -l
flutter create --template=package hello
# --android-language java/kotlin(default) --ios-language objc/swift(default)
# --platforms ios (default), android (default), windows (default), linux (default), macos (default), web (default)
flutter create --org com.example --template=plugin --platforms=android,ios,linux,macos,windows -a java -i objc hello
flutter create --org com.example --template=app --platforms=android,ios -a java -i swift myapp
# get dependencies
flutter pub get google_fonts
# remove dependencies
flutter pub remove dio
# run app
flutter run --no-enable-impeller -v
# remove android folder, recreate base on project
flutter create . --platform=android -a java
flutter template
module
Generate a project to add a Flutter module to an existing Android or iOS application.package
Generate a shareable Flutter project containing modular Dart codeplugin
Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation through method channels for Android, iOS, Linux, macOS, Windows, web, or any combination of these.plugin_ffi
Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation through dart:ffi for Android, iOS, Linux, macOS, Windows, or any combination of theseskeleton
Generate a List View / Detail View Flutter application that follows community best practices.
MODEL GENERATE
flutter pub run build_runner build
dependencies:
json_annotation: ^4.4.0
dev_dependencies:
build_runner: ^2.0.0
json_serializable: ^6.0.0
Intl
flutter pub pub run intl_translation:extract_to_arb --output-dir=i10n_arb lib/i10n/index.dart
flutter pub pub run intl_translation:generate_from_arb --ouput-dir=lib/i10n --no-use-deferred-loading lib/i10n/index.dart /home/username/Documents/project/i10n_arb/intl_*.arb
xcrun
xcrun simclt io booted recordvideo iPhone12.mp4
Version
pubspec.yaml
- The version number is three numbers separated by dots, followed by an optional build number
- Both the version and the build number may be overridden in Flutter’s build by specifying –build-name and –build-number, respectively.
- In Android, build-name is used as versionName while build-number used as versionCode.
flutter pub get
default app directory
- terminal
open
xcrun simctl get_app_container booted APP_BUNDLEID data-a Finder
- simulator
~/Library/Developer/CoreSimulator/Devices
- android ``
- ios
ios Cocopods install
sudo gem install -n /usr/local/bin cocoapods -v 1.15.2
sudo gem install cocoapods # to update cocoapods
sudo gem pristine ffi # to install/update de package
pod repo update # to update all repositories end dependencies
pod install # to install all repositories end dependencies
ios build
flutter build ipa --build-name CFBundleShortVersionString --build-number 1
rchiving com.example.app...
Automatically signing iOS for device deployment using specified development team in Xcode project: 32WVXXV78
Running pod install... 924ms
Running Xcode build...
└─Compiling, linking and signing... 6.6s
Xcode archive done. 55.0s
Built /Users/user/Documents/workspace/example/bno_app/build/ios/archive/Runner.xcarchive.
[✓] App Settings Validation
• Version Number: 1.0.0
• Build Number: 1
• Display Name: Example
• Deployment Target: 12.0
• Bundle Identifier: com.example.app
[!] App Icon and Launch Image Assets Validation
! App icon is set to the default placeholder icon. Replace with unique icons.
! Launch image is set to the default placeholder icon. Replace with unique launch image.
To update the settings, please refer to https://docs.flutter.dev/deployment/ios
Building App Store IPA... 151.2s
Built IPA to /Users/user/Documents/workspace/example/bno_app/build/ios/ipa.
To upload to the App Store either:
1. Drag and drop the "build/ios/ipa/*.ipa" bundle into the Apple Transporter macOS app https://apps.apple.com/us/app/transporter/id1450874784
2. Run "xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey your_api_key --apiIssuer your_issuer_id".
See "man altool" for details about how to authenticate with the App Store Connect API key.
Android build (AppBundle)
flutter build appbundle
- [project]/build/app/outputs/bundle/release/app.aab
Android build (APK)
flutter build apk --split-per-abi
- [project]/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
- [project]/build/app/outputs/apk/release/app-arm64-v8a-release.apk
- [project]/build/app/outputs/apk/release/app-x86_64-release.apk
Install an APK on a device
Connect your Android device to your computer with a USB cable.
cd /path/to/fx_app
flutter install
ABI(Application Binary Interface) check
adb shell getprop ro.product.cpu.abi