adapter property

T? adapter
final

Optional per-view adapter override.

When supplied, this widget uses adapter as its controller. The platform view's lifecycle callbacks (onPlatformViewCreated, onPdfFragmentReady, onViewControllerReady, onInstanceLoaded, configureFragment / configureView / configureLoad) target this adapter directly, so two NutrientDocumentViews on the same screen can use independent controllers without state leaking between them.

Ownership. When adapter is supplied, the caller owns its lifecycle — NutrientDocumentView will not call adapter.dispose. The pattern matches Flutter's controller convention (TextEditingController, ScrollController, …): allocate in the caller's initState, dispose in the caller's dispose.

If null, the controller is resolved via Nutrient.buildAdapter for T: a fresh instance from a factory registered with Nutrient.addAdapterClass (preferred — each view gets its own instance, which this widget disposes), a matching adapter from Nutrient.initialize's global slots (back-compat, shared — not disposed by this widget), or the platform default viewer.

Implementation

final T? adapter;