Flutter FAQ
Installation Issues
What to do if Flutter doctor shows errors?
The flutter doctor command checks the Flutter development environment status. Common errors and solutions:
- Android SDK not found: Need to install Android Studio or manually configure ANDROID_SDK_ROOT environment variable
- Xcode version too old: Update Xcode to the latest version
- Licenses not accepted: Run flutter doctor --android-licenses to accept licenses
What to do if downloading Flutter fails?
If download is slow or fails, try using a mirror. Chinese users can set PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL environment variables to use domestic mirrors.
What to do if Git clone fails?
Ensure network can access GitHub. Try using a proxy or domestic mirrors. You can also manually install by downloading the pre-compiled archive from the Flutter website.
Development Issues
Hot reload not working?
When hot reload fails, try: Click Stop then run again; Execute flutter clean to clean build cache; Check for syntax errors in code.
Application laggy?
Check if time-consuming operations are performed in the build method. Complex calculations should use Isolate or async processing. Avoid unnecessary widget rebuilds, use const constructors and appropriate keys.
State lost?
Hot reload preserves StatefulWidget state, but state resets when rebuilding the app or performing a full hot restart. To persist state, use SharedPreferences, SQLite, or other storage solutions.
Package dependency conflicts?
Run flutter pub get to view dependency tree. Use flutter pub deps to check package dependencies. Try updating package versions or using dependency_overrides to resolve conflicts.
Platform Issues
Android build fails?
Common causes: SDK version mismatch, Gradle configuration issues, signing configuration errors. Try running flutter clean then rebuilding. Check android/build.gradle and android/app/build.gradle configurations.
iOS simulator won't start?
Ensure Xcode is installed and configured correctly. Run xcrun simctl list devices in Terminal to view available simulators. Try resetting the simulator or creating a new one.
Web build error?
Check if web dependencies in pubspec.yaml are correct. Use flutter clean to clean then rebuild. Ensure Chrome browser is installed.
Performance Issues
App size too large?
Use flutter build apk --split-per-abi to generate APKs for different CPU architectures. Check and remove unused images and resources. Use obfuscation and compression.
Startup time too long?
Reduce initialization operations in main function. Lazy load non-essential components. Use Splash Screen to improve user experience.
Memory usage too high?
Check for memory leaks. Use Profile tools to analyze memory usage. Release resources and large objects that are no longer needed.
Learning Issues
How to choose state management solution?
Use setState for simple apps. Provider is recommended for medium complexity apps. Riverpod, GetX, or BLoC can be used for complex apps.
Migrating from other frameworks?
Flutter website has migration guides for Android, iOS, React Native developers. Core concepts are similar, focus on learning widgets and layout system.
How to improve development efficiency?
Master VS Code or Android Studio Flutter plugins. Learn shortcuts and code templates. Use hot reload and debugging tools. Reference official documentation and community resources.
