Flutter

Flutter integration

Host a Presenter in the widget tree with stable identity, current BuildContext, explicit effects, and application-owned business sources.

v1.1.0Intermediate

Flutter integration

ark_mvp_flutter connects the framework-independent contracts to Flutter through MvpView, FlutterPresenter, and MvpModelProvider.

yaml
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

ObjectCreated byReadsOwns
Business sourceApplication or feature compositionDomain dependenciesIts own resources and state
ModelBindingSame composition boundaryCurrent business snapshots and change StreamsNo business object
PresenterMvpView through createPresenterCurrent Model and active BuildContext during adaptationPresentation-local resources
ViewStatePresenterNothing after constructionNo resources
ViewFlutterViewState and Presenter actionsRender-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

  1. MvpView resolves a direct binding or the nearest exact provider.
  2. It subscribes to every Model change source before the first read.
  3. It reads the initial Model, creates Presenter, subscribes to output, and starts the session.
  4. Every Model signal, Presenter invalidation, or inherited presentation change rebuilds ViewState.
  5. Effects reach onEffect(context, effect) once.
  6. 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.