Universal Migration Guide
π Migration Guides: Migrating to flutter_commander
Section titled βπ Migration Guides: Migrating to flutter_commanderβComprehensive guides designed for both Human Developers and AI Coding Assistants (Cursor, Copilot, Claude, ChatGPT, Antigravity).
Welcome! If you are migrating an existing Flutter project from another state management framework to flutter_commander, we provide dedicated, specialized guides tailored to the paradigms of each framework:
π― Select Your Migration Guide
Section titled βπ― Select Your Migration Guideβπ¦ Migrating from BLoC (flutter_bloc) β flutter_commander
Section titled βπ¦ Migrating from BLoC (flutter_bloc) β flutter_commanderβDeconstruct monolithic god-blocs, replace bloc_concurrency (RxDart) with native ExecutionPolicy, eliminate ghost side-effects, replace nested BlocConsumer/BlocListener/BlocBuilder with CommanderView, and adopt declarative commanderTest and synchronous TestCommandScope.
π Migrating from Riverpod (flutter_riverpod) β flutter_commander
Section titled βπ Migrating from Riverpod (flutter_riverpod) β flutter_commanderβTransition from global provider declarations to scoped lifecycles (CommanderScope), gain first-class one-shot side-effect streams (SideEffect), replace ConsumerWidget and WidgetRef boilerplate with CommanderView and context.select, and simplify asynchronous testing.
π‘ Universal MVI Core Principles
Section titled βπ‘ Universal MVI Core PrinciplesβNo matter which library you are migrating from, flutter_commander follows four core principles:
-
State is Exclusively Presentation Data:
Statemust only store long-lived data needed to render UI widgets.- Ephemeral events (navigation, SnackBars, modal alerts) belong in the dedicated
SideEffectbroadcast channel (emitSideEffect(...)).
-
One Command = One Use Case:
- Complex business logic lives in standalone
Command<Intent, State, Effect>classes. - Trivial UI-only mutations (such as tab toggles) can be defined quickly using the inline DSL:
on<MyIntent>((scope, intent) => ...).
- Complex business logic lives in standalone
-
Concurrency is Declarative:
- Control race conditions directly on each Command using
ExecutionPolicy(drop,restart,queue,concurrent) and optionaldebounceorconcurrencyKey. No external stream operators required.
- Control race conditions directly on each Command using
-
Zero-Boilerplate UI:
- Use
CommanderView<C, S, E>to handle state rendering (build), one-shot effects (onEffect), and rebuild filtering (shouldRebuild) in a single widget with zero nested pyramids.
- Use
