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 jni package for direct Java/Kotlin interop.
  • iOS — Objective-C bindings via the objective_c package for direct Swift/Objective-C interop.
  • Web — JavaScript interop via dart:js_interop for 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:

  1. Advanced UI customization
    • Custom toolbar configurations
    • Platform-specific menu items
    • Contextual toolbar modifications
  2. Full event access
    • Native document lifecycle events
    • Annotation change callbacks
    • Page rendering events
  3. Platform-specific features
    • Features only available on one platform
    • Deep integration with native APIs
    • Custom rendering or processing
  4. 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.

Platform adapters architecture

Key components

  1. NutrientView — Flutter widget for displaying PDF documents; accepts an optional adapter parameter
  2. Nutrient — SDK initialization and license configuration
  3. NutrientController — Base controller class for document interaction
  4. 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, or NutrientWebAdapter)
  • Receives lifecycle callbacks for customization
  • Implements custom controller interfaces
  • Has full access to native SDK APIs

Adapter pattern

Package structure

Nutrient Flutter SDK is composed of several packages:

PackagePurpose
nutrient_flutterMain entry point, exports unified API
nutrient_flutter_platform_interfacePlatform-agnostic interfaces and base classes
nutrient_flutter_androidAndroid JNI bindings and AndroidAdapter
nutrient_flutter_iosiOS Objective-C bindings and IOSAdapter
nutrient_flutter_webWeb JS interop bindings and NutrientWebAdapter

Next steps