This guide provides step-by-step instructions for migrating from older versions of this Flutter Instagram clone to the latest version with Flutter SDK 3.35.7 (as of November 2, 2025).
This is a major breaking migration that includes:
- Flutter SDK upgrade to 3.35.7 (latest)
- All dependencies updated to latest compatible versions
- Deprecated Flutter/Dart code resolved
- Updated
analysis_options.yaml - Breaking dependencies removed and bumped
- Latest Android
targetSdk,compileSdk, and AGP versions - Updated
build_runner,freezed, andjson_annotationversions
If you have made custom changes to a forked version of this repository:
It is strongly recommended to completely fork this new version and re-apply your changes manually, rather than trying to merge/pull the updates. The number of breaking changes is extensive and would be difficult to resolve individually.
Before starting the migration, ensure you have:
- FVM (Flutter Version Management) - Recommended for managing Flutter SDK versions
- Flutter SDK 3.35.7 (will be installed via FVM)
- Dart SDK ≥3.9.0 (automatically configured with FVM)
- Android Studio with latest Android SDK
- Xcode (for iOS development)
- Git for version control
# Create a backup of your current project
cp -r your_project_folder your_project_folder_backup# Navigate to your project root
cd your_project_folder
# Clean Flutter
flutter clean
# Clean build artifacts
rm -rf build/
rm -rf .dart_tool/
rm pubspec.lockFVM is the recommended tool for managing Flutter SDK versions effectively. It allows you to have distinct global and local Flutter SDK versions, making it perfect for managing multiple Flutter projects.
Benefits of using FVM:
- 🔄 Switch between Flutter versions per project
- 🛠️ Automatic Dart SDK configuration with
--setup - 📦 No conflicts between different Flutter projects
- 🚀 Easy version management and updates
- 💾 Efficient storage (shared Flutter installations)
Refer to the official FVM documentation for installation instructions specific to your operating system.
# Install Flutter 3.35.7 with automatic setup
# The --setup flag automatically configures Dart SDK and other configurations
fvm install 3.35.7 --setup# Navigate to your project root
cd your_project_folder
# Use Flutter 3.35.7 locally for this project
fvm use 3.35.7# Set Flutter 3.35.7 as global default (optional)
fvm global 3.35.7# List all installed Flutter SDK versions
fvm list
# Verify Flutter version for this project
fvm flutter --version
# Should show Flutter 3.35.7
# Or if you set it globally
flutter --versionThis project includes helpful utility scripts in the scripts/ folder:
build_runner.sh- Manages build_runner for code generationget_all.sh- Installs all dependencies across packagesbuild_and_open_apk.sh- Builds and opens APKsetup_env.sh- Sets up environment variables
# Use the utility script to get all dependencies
./scripts/get_all.sh
# If using FVM locally, you can also run:
# fvm flutter pub get (for root project)This script will:
- Install root project dependencies
- Install all package dependencies recursively
- Show progress with spinners and status indicators
Critical: Due to updated build_runner, freezed, and json_annotation versions, you must clean and rebuild generated code.
# Clean build_runner for shared package
./scripts/build_runner.sh shared clean
# Rebuild shared package
./scripts/build_runner.sh shared# Clean build_runner for insta_blocks package
./scripts/build_runner.sh insta_blocks clean
# Rebuild insta_blocks package
./scripts/build_runner.sh insta_blocks# Clean root project build_runner
dart run build_runner clean
# Rebuild with conflict resolution
dart run build_runner build --delete-conflicting-outputs# Generate localization files
flutter gen-l10n
# If using FVM locally:
# fvm flutter gen-l10n# Navigate to iOS directory
cd ios
# Update CocoaPods
pod update
# Return to project root
cd ..# Check for any dependency issues
flutter doctor
# If using FVM locally:
# fvm flutter doctor
# Verify project can build
flutter build apk --debug
# If using FVM locally:
# fvm flutter build apk --debug# If you encounter build_runner conflicts
dart run build_runner clean
flutter clean
flutter pub get
dart run build_runner build --delete-conflicting-outputs# Clear pub cache if needed
flutter pub cache clean
flutter pub get
# If using FVM locally:
# fvm flutter pub cache clean
# fvm flutter pub get- Ensure your
android/app/build.gradlehas updatedcompileSdkandtargetSdk - Check that Android Gradle Plugin (AGP) version is compatible
- Clean Android build:
cd android && ./gradlew clean
cd ios
pod deintegrate
pod install
cd ..# List all installed Flutter versions
fvm list
# Check which Flutter version is being used locally
fvm flutter --version
# Reinstall Flutter version if corrupted
fvm install 3.35.7 --setup --force
# Remove unused Flutter versions to save space
fvm remove <version>
# Check FVM configuration
fvm doctor# Use the utility script
./scripts/build_and_open_apk.sh --flavor development# Use the utility script
./scripts/build_and_open_apk.sh --flavor productionbuild_runner: ^2.6.0freezed: ^3.2.3json_annotation: ^4.9.0json_serializable: ^6.11.1very_good_analysis: ^9.0.0- All Firebase dependencies to latest versions
- Updated UI and utility packages
- Minimum Dart SDK:
>=3.9.0 - Minimum Flutter:
>=3.35.7 - Resolved deprecated API usage
- Updated analysis options
- Updated
targetSdkandcompileSdk - Latest Android Gradle Plugin (AGP)
- Updated Android dependencies
If you encounter issues during migration:
- Check the troubleshooting section above
- Ensure all prerequisites are met
- Verify Flutter and Dart versions
- Consider the recommended approach of forking the new version
- FVM installed and configured
- Flutter SDK 3.35.7 installed via FVM with
--setup - Local Flutter version set to 3.35.7 for this project (
fvm use 3.35.7) - All dependencies installed successfully
- Code generation completed without errors
- Localizations generated
- iOS pods updated (if applicable)
- App builds successfully
- All features working as expected
- FVM commands working correctly (
fvm list,fvm flutter --version)
Note: This migration represents a significant update. Take time to test all functionality after migration to ensure everything works correctly with the new versions.