Upgrade


πŸ“ Description

The upgrade command updates all packages in your Flutter project to their latest compatible versions. It intelligently manages version constraints, resolves conflicts, and ensures your project remains stable while benefiting from the latest improvements.


βš™οΈ Usage

gexd upgrade [package_name] [options]
gexd upgrade [options]

πŸ“‹ Basic Examples:

# Upgrade all packages
gexd upgrade

# Upgrade specific package
gexd upgrade http

# Upgrade multiple specific packages
gexd upgrade http dio shared_preferences

# Preview upgrades without applying
gexd upgrade --dry-run

# Major version upgrades
gexd upgrade --major-versions

# Upgrade dev dependencies only
gexd upgrade --dev-dependencies

🚩 Flags

Flag
Description

--dry-run

Show available upgrades without applying changes

--major-versions

Allow major version upgrades

--dev-dependencies

Upgrade dev dependencies only

--no-dev-dependencies

Skip dev dependencies

--force

Force upgrade without compatibility checks

--precompile

Precompile executables after upgrade


🎯 Upgrade Process:

  1. πŸ“Š Dependency Analysis - Analyzes current package versions

  2. πŸ” Version Discovery - Finds latest compatible versions

  3. ⚠️ Conflict Detection - Identifies potential breaking changes

  4. πŸ“‹ Upgrade Plan - Shows what will be changed

  5. βœ… User Confirmation - Asks for approval before applying

  6. ⬇️ Package Update - Downloads and installs new versions


πŸ“Š Examples by Scope:

Full Project Upgrade:

# Upgrade everything safely
gexd upgrade

# Preview all available upgrades
gexd upgrade --dry-run

# Upgrade with major versions (risky)
gexd upgrade --major-versions

Targeted Upgrades:

# Upgrade specific package
gexd upgrade flutter_svg

# Upgrade state management packages
gexd upgrade get riverpod bloc

# Upgrade dev tools only
gexd upgrade --dev-dependencies

Safe Upgrades:

# Minor and patch updates only
gexd upgrade --no-major-versions

# With compatibility verification
gexd upgrade --verify-compatibility

βœ… What It Does:

  1. πŸ“‹ Version Analysis - Compares current vs available versions

  2. πŸ” Compatibility Check - Ensures version compatibility

  3. πŸ“ pubspec.yaml Update - Updates version constraints

  4. ⬇️ Package Resolution - Resolves and downloads packages

  5. πŸ§ͺ Build Test - Optionally tests build after upgrade

  6. πŸ“Š Upgrade Report - Shows summary of changes


πŸ›‘οΈ Safety Features:

  • ⚠️ Breaking Change Detection: Warns about major version changes

  • πŸ”„ Dependency Resolution: Solves version conflicts automatically

  • πŸ’Ύ Backup Creation: Backs up pubspec.yaml before changes

  • πŸ§ͺ Build Verification: Tests compilation after upgrade

  • πŸ“‹ Detailed Reporting: Shows exactly what changed


πŸ“Š Upgrade Strategies:

# Minor and patch updates only
gexd upgrade

Moderate:

# Include compatible minor versions
gexd upgrade --minor-versions

Aggressive (Risky):

# Allow major version updates
gexd upgrade --major-versions

πŸ”§ Advanced Options:

Selective Upgrades:

# Upgrade specific categories
gexd upgrade --category ui          # UI packages
gexd upgrade --category networking  # Network packages
gexd upgrade --category testing     # Test packages

Constraint Management:

# Update constraints in pubspec.yaml
gexd upgrade --update-constraints

# Lock to exact versions
gexd upgrade --lock-versions

⚠️ Potential Issues:

Breaking Changes:

  • πŸ” API Changes: New versions might have different APIs

  • ⚑ Performance Impact: New versions might affect performance

  • 🧩 Dependency Conflicts: Packages might have conflicting requirements

Recovery:

# Restore from backup
gexd upgrade --restore-backup

# Downgrade specific package
gexd downgrade package_name version

# Reset to working state
git checkout pubspec.yaml pubspec.lock
dart pub get

πŸ“… Best Practices:

  1. πŸ§ͺ Test Before Committing: Run tests after upgrade

  2. πŸ“¦ Incremental Upgrades: Update few packages at a time

  3. πŸ“‹ Read Release Notes: Check changelog for breaking changes

  4. πŸ’Ύ Version Control: Commit before upgrading

  5. πŸ”„ CI/CD Verification: Ensure pipeline still passes


⚠️ Notes:

  • πŸ“Š Semantic Versioning: Follows semver for safe upgrades

  • πŸ” Pub.dev Integration: Fetches latest versions from pub.dev

  • ⚑ Performance Impact: Larger projects take longer to analyze

  • πŸ”’ Network Required: Needs internet to check for updates


Generated automatically by gexd_doc

Last updated