Platform adapters
Nutrient Flutter SDK includes platform adapters as a built-in extensibility mechanism. They give you direct access to the native Nutrient PDF SDKs on each platform, enabling advanced customization beyond what the cross-platform API exposes.
Platform adapters are currently in beta. APIs may change in future releases.
What are platform adapters?
Platform adapters are an extension point in Nutrient Flutter SDK that use native language bindings to communicate with the underlying Nutrient PDF SDKs:
- Android — JNI bindings via the
jnipackage for direct Java/Kotlin interop. - iOS — Objective-C bindings via the
objective_cpackage for direct Swift/Objective-C interop. - Web — JavaScript interop via
dart:js_interopfor direct access to Nutrient Web SDK.
Pass an adapter to NutrientView for capabilities beyond the standard PdfConfiguration options — such as listening to native lifecycle events, customizing platform-specific UI elements, or calling native SDK methods directly.
When to use platform adapters
Platform adapters are appropriate for the following use cases:
- Advanced UI customization
- Custom toolbar configurations
- Platform-specific menu items
- Contextual toolbar modifications
- Full event access
- Native document lifecycle events
- Annotation change callbacks
- Page rendering events
- Platform-specific features
- Features only available on one platform
- Deep integration with native APIs
- Custom rendering or processing
- Direct platform SDK access
- Direct calls via JNI (Android), FFI (iOS), or JS interop (Web)
- Fine-grained control over SDK behavior
Architecture
Platform adapters follow a layered architecture within Nutrient Flutter SDK, outlined in the image below.
Key components
- NutrientView — Flutter widget for displaying PDF documents; accepts an optional
adapterparameter - Nutrient — SDK initialization and license configuration
- NutrientController — Base controller class for document interaction
- Platform adapters — Customizable bridges to native SDK functionality
The adapter pattern
Platform adapters are the core extension point. Each adapter:
- Extends a base adapter class (
AndroidAdapter,IOSAdapter, orNutrientWebAdapter) - Receives lifecycle callbacks for customization
- Implements custom controller interfaces
- Has full access to native SDK APIs
Package structure
Nutrient Flutter SDK is composed of several packages:
| Package | Purpose |
|---|---|
nutrient_flutter | Main entry point, exports unified API |
nutrient_flutter_platform_interface | Platform-agnostic interfaces and base classes |
nutrient_flutter_android | Android JNI bindings and AndroidAdapter |
nutrient_flutter_ios | iOS Objective-C bindings and IOSAdapter |
nutrient_flutter_web | Web JS interop bindings and NutrientWebAdapter |
Next steps
- Getting started — Installation and setup
- Usage patterns — Examples and patterns
- Platform imports — Handling platform-specific imports