flutter_state_migrator 2.1.1 copy "flutter_state_migrator: ^2.1.1" to clipboard
flutter_state_migrator: ^2.1.1 copied to clipboard

Automated CLI tool to migrate Flutter apps from Provider, BLoC, GetX, and MobX to Riverpod.

🚀 Flutter State Migrator #

CI/CD Pub Version License: MIT

Flutter State Migrator is a powerful CLI tool designed to automate the modernization of Flutter applications by migrating state management from Provider (or BLoC/Cubit) to Riverpod.

Using advanced AST (Abstract Syntax Tree) analysis, it intelligently refactors your source code, updates imports, and injects Riverpod best practices, saving you days of manual refactoring.


✨ Key Features #

  • AST-Based Transformation: Intelligent source code rewriting using the official Dart analyzer.
  • Multi-Library Support: Migrates from Provider, ChangeNotifierProvider, Bloc, and Cubit.
  • Intelligent Logic Mapping: Refactors notifyListeners() and emit() into idiomatic Riverpod state updates.
  • Interactive Dry-run: Preview all changes with colorized console diffs before applying them.
  • Monorepo Aware: Automatically detects and handles multiple packages in a single workspace.
  • VS Code Integration: Right-click to migrate directly from your IDE.
  • Detailed Audit Reports: Generates migration_report.json with complexity scores and metrics.
  • Import Management: Automatically manages flutter_riverpod imports and prunes legacy ones.

🚀 Quick Start #

Installation #

Install the migrator globally via pub.dev:

dart pub global activate flutter_state_migrator

The package is published as flutter_state_migrator, but the installed CLI command is migrator.

Usage #

Run the migrator on your project directory:

# Preview changes (Dry Run)
migrator --mode aggressive --dry-run .

# Apply changes directly
migrator --mode aggressive .

# Generate a dependency visualization graph
migrator --visualize .

🛠️ Configuration #

You can customize the migration behavior by adding a migrator_config.yaml to your project root:

provider_naming: camelCase  # or PascalCase
auto_merge_state: true      # Toggle automatic state class merging

📖 Documentation #

  • Detailed Migration Guide: Understand how patterns are transformed.
  • VS Code Extension: IDE integration details.
  • Contributing: How to help improve the migrator.

🤝 Contributing #

Contributions are welcome! Please read our Contributing Guidelines to get started.

📄 License #

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ for the Flutter Community.

4
likes
0
points
93
downloads

Publisher

unverified uploader

Weekly Downloads

Automated CLI tool to migrate Flutter apps from Provider, BLoC, GetX, and MobX to Riverpod.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, args, cupertino_icons, flutter, flutter_riverpod, path, provider, yaml

More

Packages that depend on flutter_state_migrator