---
title: "Flutter SDK 4 migration guide"
canonical_url: "https://www.nutrient.io/guides/flutter/migration-guides/flutter-4-migration-guide/"
md_url: "https://www.nutrient.io/guides/flutter/migration-guides/flutter-4-migration-guide.md"
last_updated: "2026-05-30T02:20:01.297Z"
description: "Follow this guide to update your project for Nutrient Flutter SDK 4 with essential changes and API updates."
---

# Flutter SDK 4 migration guide

Nutrient Flutter SDK 4 introduces a significant update with native API bridging using Pigeon, a change that requires updating your project to utilize the new API. This guide will help you transition to the new API, including relocating and renaming some classes and methods.

Follow this guide to ensure your project is compatible with Nutrient Flutter SDK 4.

## Removed APIs

1. The paths `pspdfkit-flutter/lib/widgets/pspdfkit_widget.dart` and `pspdfkit-flutter/lib/widgets/pspdfkit_widget_controller.dart` have been removed. Instead, use `package:pspdfkit_flutter/pspdfkit_pspdfkit.dart` for all imports.

2. The optional parameters for `measurementScale` and `measurementPrecision` have been removed from `Pspdfkit.present`. Use the `measurementValueConfigurations` option in `PdfConfiguration` instead.

## Deprecated APIs

The following APIs have been deprecated in Nutrient Flutter SDK 4.

1. `Pspdfkit.setLicenseKey` and `Pspdfkit.setLicenseKeys` have been deprecated. Use `Pspdfkit.initialize` instead:

   ```dart

   Pspdfkit.initialize(
       androidLicenseKey: 'YOUR_ANDROID_LICENSE_KEY',
       iosLicenseKey: 'YOUR_IOS_LICENSE_KEY',
       webLicenseKey: 'YOUR_WEB_LICENSE_KEY',
   );
   ```

2. The following methods in `PspdfkitWidgetController` have been deprecated in Nutrient Flutter SDK 4. Use the corresponding methods in `PdfDocument` instead:
   - `setFormFieldValue` — Use `PdfDocument.setFormFieldValue`.
   - `getFormFieldValue` — Use `PdfDocument.getFormFieldValue`.
   - `applyInstantJson` — Use `PdfDocument.applyInstantJson`.
   - `exportInstantJson` — Use `PdfDocument.exportInstantJson`.
   - `addAnnotation` — Use `PdfDocument.addAnnotation`.
   - `removeAnnotation` — Use `PdfDocument.removeAnnotation`.
   - `getAnnotations` — Use `PdfDocument.getAnnotations`.
   - `getAllUnsavedAnnotations` — Use `PdfDocument.getAllUnsavedAnnotations`.

3. `PspdfkitProcessor` has been deprecated. The `PspdfkitProcessor` class methods can now be statically accessed from the `Pspdfkit` class.

## Other API changes

Some APIs have been moved to new locations and renamed in Nutrient Flutter SDK 4. To ensure your project works correctly, update your code to use a single import statement for all Nutrient Flutter SDK classes and methods:

```dart

import 'package:pspdfkit_flutter/pspdfkit_flutter.dart';

```

## Method channel backward compatibility

Nutrient Flutter SDK 4 introduces a new method channel API using Pigeon to bridge native APIs for iOS and Android. However, you can still use the old method channel APIs for backward compatibility. These will be removed in a future release.

To use the old method channel APIs, set the `useLegacy` parameter to `true` when initializing the SDK:

```dart

Pspdfkit.initialize(
    useLegacy: true,
);

```

## Updating to Nutrient Flutter SDK 4

To update your project to use Nutrient Flutter SDK 4, follow the steps below.

1. Update your `pubspec.yaml` file to use the latest version of the Nutrient Flutter SDK:

   ```yaml

   dependencies:
   pspdfkit_flutter: ^4.0.0
   ```

## Changelog

For a complete list of changes in Nutrient Flutter SDK 4, see the [changelog](https://www.nutrient.io/guides/flutter/changelog.md).
---

## Related pages

- [Flutter 1 10 4 Migration Guide](/guides/flutter/migration-guides/flutter-1-10-4-migration-guide.md)
- [Flutter 3 3 Migration Guide](/guides/flutter/migration-guides/flutter-3-3-migration-guide.md)
- [Flutter 3 12 Migration Guide](/guides/flutter/migration-guides/flutter-3-12-migration-guide.md)
- [Flutter 3 6 Migration Guide](/guides/flutter/migration-guides/flutter-3-6-migration-guide.md)
- [Flutter SDK 3 migration guide](/guides/flutter/migration-guides/flutter-3-migration-guide.md)
- [Flutter 3 2 Migration Guide](/guides/flutter/migration-guides/flutter-3-2-migration-guide.md)
- [Flutter 3 9 Migration Guide](/guides/flutter/migration-guides/flutter-3-9-migration-guide.md)
- [Download and run the migration script.](/guides/flutter/migration-guides/flutter-5-migration-guide.md)
- [Flutter SDK 4.2 migration guide](/guides/flutter/migration-guides/flutter-4-2-migration-guide.md)
- [Upgrade to the latest Flutter version](/guides/flutter/migration-guides/upgrading.md)

