Flutter
Flutter integration
Host a Presenter in the widget tree with stable identity, current BuildContext, explicit effects, and application-owned business sources.
Flutter integration
ark_mvp_flutter connects the framework-independent contracts to Flutter through MvpView, FlutterPresenter, and MvpModelProvider.
dependencies:
ark_mvp: ^1.1.0
ark_mvp_flutter: ^1.1.0
Declare the core package directly when application code imports ModelBinding, Presenter, or another core type.
Responsibility map
| Object | Created by | Reads | Owns |
|---|---|---|---|
| Business source | Application or feature composition | Domain dependencies | Its own resources and state |
ModelBinding | Same composition boundary | Current business snapshots and change Streams | No business object |
| Presenter | MvpView through createPresenter | Current Model and active BuildContext during adaptation | Presentation-local resources |
| ViewState | Presenter | Nothing after construction | No resources |
| View | Flutter | ViewState and Presenter actions | Render-local Flutter objects in its State |
This map prevents two common mistakes: creating the business object inside Presenter, and moving formatting or button policy back into the View.
Runtime flow
MvpViewresolves a direct binding or the nearest exact provider.- It subscribes to every Model change source before the first read.
- It reads the initial Model, creates Presenter, subscribes to output, and starts the session.
- Every Model signal, Presenter invalidation, or inherited presentation change rebuilds ViewState.
- Effects reach
onEffect(context, effect)once. - Removing or replacing the feature closes Presenter.
Open the lifecycle and ownership pages for the exact identity, error, and teardown rules.
Use a direct model argument when the owner and MvpView are close in the tree. Use MvpModelProvider.value when several descendants share one stable binding or a screen should obtain it by exact Model type. Both paths create the same Presenter lifecycle.