Platform adapters
Nutrient Flutter SDK includes platform adapters for extending viewer behavior. Platform adapters give you direct access to the native Nutrient PDF SDKs on Android, iOS, and Web when the cross-platform API doesn’t cover your use case.
Every NutrientDocumentView uses an adapter as its controller. This means one object gives you access to the cross-platform API and the native SDK.
Most apps only need the built-in controller. Use the cross-platform API on controller.document and controller.events for document operations and events that work the same way across platforms. Subclass a platform adapter only when you need native behavior that the cross-platform API doesn’t expose.
Starting with Nutrient Flutter SDK 6, document, annotation, form, bookmark, and event operations use the same bindings architecture. Use platform adapters to access native APIs instead of raw MethodChannel calls or the generated Pigeon bridge.
When you need an adapter
Use this table to choose the right approach for your app:
| You need… | Use |
|---|---|
| To view a document and use the cross-platform API — annotations, bookmarks, forms, save/export, the event stream | A bare NutrientDocumentView(...) — no adapter |
| Custom native behavior — typed native handles, custom lifecycle hooks, your own controller methods | A registered controller (addAdapterClass<T> + NutrientDocumentView<T>) |
| To hold or drive the controller yourself, or run multiple independent views at once | A per-view adapter: instance you create and dispose of |
Native bindings per platform
A platform adapter subclasses the base class for its target platform and gives you typed access to the underlying native SDK:
- Android — Use
AndroidAdapter, backed by JNI bindings from thejnipackage. - iOS — Use
IOSAdapter, backed by Objective-C bindings from theobjective_cpackage. - Web — Use
NutrientWebAdapter, backed by JavaScript interop withdart:js_interop.
The adapter is the controller, so one object gives you access to the cross-platform API and native handles.
Architecture
NutrientDocumentView resolves a controller — the platform adapter — that bridges to the native SDK on each platform.
Each adapter extends its platform base class, receives lifecycle callbacks, implements your shared controller interface, and exposes the native SDK objects.
Next steps
Continue with these guides:
- Refer to the getting started guide to display a document and create your first adapter.
- Refer to the usage patterns guide for native configuration, controller operations, and native events.
- Refer to the platform imports guide to handle platform-specific imports.