Flutter Document SDK by Nutrient
Add powerful PDF functionality to your Flutter apps with the Nutrient Flutter SDK. View, annotate, and edit PDFs seamlessly across Android, iOS, and Web platforms.

Requirements
- Flutter 3.44.6 or later
- For Android:
- Android Studio (latest stable version)
- Android NDK
- Android API level 24 or later
- Android Virtual Device or physical device
- For iOS:
- Xcode 16 or later
- iOS 17.0 or later
- For Web:
- Modern web browser with WebAssembly support
Installation
- Add the Nutrient Flutter SDK to your
pubspec.yaml:
dependencies:
nutrient_flutter: ^6.0.0
If you are building against the bindings API — recommended for new applications — also add the platform packages as direct dependencies, so the federated plugins are registered at runtime:
dependencies:
nutrient_flutter: ^6.0.0
nutrient_flutter_platform_interface: ^2.0.0
nutrient_flutter_android: ^2.0.0
nutrient_flutter_ios: ^2.0.0
nutrient_flutter_web: ^2.0.0
- Run the following command:
flutter pub get
Platform Setup
Android Setup
- Update your Android configuration in
android/app/build.gradle:
android {
compileSdkVersion 36
defaultConfig {
minSdkVersion 24
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:<version>'
}
- Update your theme in
android/app/src/main/res/values/styles.xml:
- <style name="NormalTheme" parent="Theme.AppCompat.Light.NoActionBar">
+ <style name="NormalTheme" parent="PSPDFKit.Theme.Default">
- Update your main activity to use
FlutterAppCompatActivity:
import io.flutter.embedding.android.FlutterAppCompatActivity
class MainActivity: FlutterAppCompatActivity() {
}
Note: As of 6.0.0 this class ships in nutrient_flutter_android. The import
path is unchanged, and it is still available when you depend on
nutrient_flutter. Its built-in AiAssistantProvider integration was removed —
if you relied on it, re-add it in your own app module as described in the
bindings migration guide.
iOS Setup
Make sure to set the minimum iOS version to 17.0 in your ios/Podfile:
platform :ios, '17.0'
Web Setup
You can include the Nutrient Web SDK using either CDN or local installation:
Option 1: CDN (Recommended)
Add the following script to your web/index.html file:
<script src="https://cdn.cloud.nutrient.io/pspdfkit-web@1.17.0/nutrient-viewer.js"></script>
Note: Replace 1.17.0 with the latest version of Nutrient Web SDK. Check the latest releases for the current version.
Option 2: Local Installation
-
Download Nutrient Web SDK. The download will start immediately and save a
.tar.gzarchive likePSPDFKit-Web-binary-<version>.tar.gzto your computer. -
Once downloaded, extract the archive and copy the entire contents of its
distfolder to your project'sweb/assetsfolder. -
Verify your
assetsfolder contains:nutrient-viewer.jsfilenutrient-viewer-libdirectory with library assets
-
Add the Nutrient library to your
web/index.html:
<script src="assets/nutrient-viewer.js"></script>
Note: Your server must have the Content-Type: application/wasm MIME type configured for WebAssembly files.
Sample Document Setup
- Create a
PDFsdirectory in your project root:
mkdir PDFs
-
Download our sample PDF document and save it as
Document.pdfin thePDFsdirectory. -
Add the assets directory to your
pubspec.yaml:
flutter:
assets:
- PDFs/
Usage
Create a new file lib/main.dart with the following content:
import 'package:flutter/material.dart';
import 'package:nutrient_flutter/nutrient_flutter.dart';
import 'dart:io';
import 'package:flutter/foundation.dart';
const String documentPath = 'PDFs/Document.pdf';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize the Nutrient SDK with your license key
await Nutrient.initialize(
androidLicenseKey: 'YOUR_ANDROID_LICENSE_KEY',
iosLicenseKey: 'YOUR_IOS_LICENSE_KEY',
webLicenseKey: 'YOUR_WEB_LICENSE_KEY',
);
runApp(const MaterialApp(
home: MyApp(),
));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
Future<String> extractAsset(BuildContext context, String assetPath) async {
if (kIsWeb) {
return assetPath;
}
final bytes = await DefaultAssetBundle.of(context).load(assetPath);
final list = bytes.buffer.asUint8List();
final tempDir = await Nutrient.getTemporaryDirectory();
final tempDocumentPath = '${tempDir.path}/$assetPath';
final file = File(tempDocumentPath);
await file.create(recursive: true);
file.writeAsBytesSync(list);
return file.path;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<String>(
future: extractAsset(context, documentPath),
builder: (context, snapshot) {
if (snapshot.hasData) {
/// NutrientView is a widget that displays a PDF document.
return NutrientView(
documentPath: snapshot.data!,
);
} else if (snapshot.hasError) {
return Center(
child: Text('${snapshot.error}'),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
}),
);
}
}
Note: Replace 'YOUR_ANDROID_LICENSE_KEY', 'YOUR_IOS_LICENSE_KEY', and 'YOUR_WEB_LICENSE_KEY' with your actual license keys. Do not pass any license keys if you want to run the SDK in demo mode, the SDK will run in demo mode with a watermark.
Bindings API
The example above uses the original API, imported from
package:nutrient_flutter/nutrient_flutter.dart.
As of 6.0.0, the bindings API is the recommended surface for new applications. It is a separate entry point:
import 'package:nutrient_flutter/bindings.dart';
It gives you NutrientDocumentView with a typed controller.events stream,
platform adapters for reaching native SDK APIs that the cross-platform surface
does not cover yet, and NutrientInstantView for real-time collaboration.
Bindings applications must list the platform packages as direct dependencies —
see Installation.
Start with the bindings migration guide.
Upgrading from 5.x
6.0.0 removes the legacy MethodChannel bridge, including Pspdfkit.useLegacy
and the useLegacy: parameter on Pspdfkit.initialize(...). See the
removal notes for what to
change, and the CHANGELOG for the full list of breaking changes.
Learn More
- Documentation
- Example Projects
- Release Notes
- Customization
- Migration Guide
- Bindings Migration Guide - Move to the recommended bindings API
- Legacy MethodChannel Removal - What changed in 6.0.0 and how to migrate
- Working with Annotations - Read, create, search, and remove annotations with typed models
- Working with Forms - Read AcroForm fields as typed models and fill them in
- Working with Events - React to document, annotation, and form changes through one typed stream
- Customizing the Toolbars - Reorder, group, and extend the main and annotation toolbars from Dart
- Headless Document API - Open documents without a viewer for batch processing
- Dirty State Tracking - Track unsaved changes across platforms
- Configuring Signatures - Customize the signature creation UI and saving strategy
Support
Visit our Support Center for help with the SDK.
License
This project is licensed under the Nutrient Commercial License. See LICENSE for details.
Libraries
- bindings
- Copyright © 2018-2026 PSPDFKit GmbH. All rights reserved.
- nutrient_flutter
- Copyright © 2018-2026 PSPDFKit GmbH. All rights reserved.
- pspdfkit_flutter
- Copyright © 2018-2026 PSPDFKit GmbH. All rights reserved.