---
title: "Migration Guide"
description: "Migrate between versions of Sentry's SDK for Dart."
url: https://docs.sentry.io/platforms/dart/guides/flutter/migration/
---

# Migration Guide | Sentry for Flutter

## [Migrating from `sentry_flutter` `8.x` to `sentry_flutter` `9.x`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-8x-to-sentry_flutter-9x)

### [General](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#general)

#### [Dart and Flutter versions](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#dart-and-flutter-versions)

The required minimum Dart and Flutter versions are now `3.5.0` and `3.24.0` respectively. This change allows us to use safer APIs and better support for features such as Session Replay and WASM compilation.

#### [Android API version](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#android-api-version)

The required minimum Android API is now `21`.

#### [API Removals and Renames](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#api-removals-and-renames)

* The `beforeScreenshot` method has been replaced by `beforeCaptureScreenshot`.
* Manual TTID implementation has been removed as the automatic TTID instrumentation has proven to be accurate enough so a manual one is not needed anymore.
* `LoadImagesListIntegration` has been renamed to `LoadNativeDebugImagesIntegration`.
* The `enableTracing` option has been removed. Use `options.traceSampleRate` or `options.tracesSampler` instead.
* Both `options.autoAppStart` and `setAppStartEnd` have been removed. The [App Start Instrumentation](https://docs.sentry.io/platforms/dart/guides/flutter/integrations/app-start-instrumentation.md) will now determine the end of app start and is enabled by default.
* Usage of `dart:html` has been removed in favor of `package:web`. The SDK is now packaged with the `package:web` dependency for better interoperability with web APIs.
* The `beforeSendTransaction` callback now has a `Hint` parameter.
* The option `attachScreenshotOnlyWhenResumed` has been removed.
* The `segment` field from `SentryUser` has been removed.
* The old user feedback API has been removed and replaced by `Sentry.captureFeedback`.

#### [Response Body Handling](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#response-body-handling)

Due to PII concerns, response bodies will no longer be added to Sentry events by the SDK automatically. Responses are now attached to the `Hint` object, which can be read in `beforeSend`/`beforeSendTransaction` callbacks via `hint.response` so you can manually attach the response to your event. Response bodies with a size greater than 0.15MB are not added to the hint object. Currently as of version `9.0.0`, only the `dio` integration is supported.

#### [Screenshots](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#screenshots)

Screenshots are now masked by default for privacy reasons. For example, text fields are automatically masked to prevent sensitive information from being leaked. Read the guide [here](https://docs.sentry.io/platforms/dart/guides/flutter/enriching-events/screenshots.md#redact-screenshots-via-masking) for more information on how to customize the masking.

#### [Logging](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#logging)

The default log level is now `warning` when `debug = true`. This can be adjusted by setting `options.diagnosticLevel = SentryLevel.info` in `SentryFlutter.init`.

#### [SDK Data Classes](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#sdk-data-classes)

SDK data classes are now mutable which makes it easier to manipulate them. For backwards-compatibility, `copyWith` and `clone` can still be used but are officially deprecated.

```dart
// old
options.beforeSend = (event, hint) {
  event = event.copyWith(release: 'my-release');
  return event;
}

// new
options.beforeSend = (event, hint) {
  event.release = 'my-release';
  return event;
}
```

### [Flutter Desktop](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#flutter-desktop)

Native crash handling is now enabled by default for Flutter Desktop. Windows ARM64 uses [breakpad](https://chromium.googlesource.com/breakpad/breakpad) and all other desktop platforms use [crashpad](https://chromium.googlesource.com/crashpad/crashpad). You can disable this feature by setting the `SENTRY_NATIVE_BACKEND` environment variable to "none". e.g `export SENTRY_NATIVE_BACKEND=none`

If you encounter any issues, please refer to the [troubleshooting guide](https://docs.sentry.io/platforms/dart/guides/flutter/troubleshooting.md#issues-with-native-crashes-on-linux-andor-windows).

### [Flutter Web](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#flutter-web)

The interop with the [Sentry Browser Javascript SDK](https://docs.sentry.io/platforms/javascript.md) is now enabled by default. During `SentryFlutter.init` the SDK will inject the CDN script into the HTML's head. This change allows us to utilize existing SDK functionality such as native JS Errors, add new features such as release health and makes it easier to develop features such as debug ids in the future.

If you initialize the native SDKs separately with `options.autoInitializeNativeSdk = false` you will also need to add the Sentry Browser Javascript SDK to your website's HTML head. [Read this guide](https://docs.sentry.io/platforms/javascript/install/loader.md#cdn) on how to install the SDK into your application via CDN bundles.

### [Drift Integration](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#drift-integration)

We have bumped the required Drift version to `2.24.0` and have changed the API on how to use the integration. Instead of a `SentryQueryExecutor`, Sentry now provides a `SentryQueryInterceptor` that you can use like so:

```dart
final executor = NativeDatabase.memory().interceptWith(
  SentryQueryInterceptor(databaseName: 'your_db_name')
);
```

For more information on how to use `QueryInterceptor` read the [Drift documentation](https://drift.simonbinder.eu/examples/tracing/).

## [Migrating From `sentry_flutter` `6.18.x` to `sentry_flutter` `7.0.0`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-618x-to-sentry_flutter-700)

In addition to the changes introduced in [sentry](https://docs.sentry.io/platforms/dart/migration.md):

API changes:

* Sentry's Flutter SDK version 7.0.0 and above requires Flutter `3.0.0`.

* [`sentry_dio`](https://pub.dev/packages/sentry_dio), version 7.0.0 requires [`dio 5.0.0`](https://pub.dev/packages/dio)

* The Sentry Cocoa SDK was upgraded to `8.0.0` which introduces breaking changes, see the [migration guide](https://docs.sentry.io/platforms/apple/migration.md#migrating-from-7x-to-8x).

* The following fields have been removed from the `SentryFlutterOptions` class and replaced:

  * `enableAutoPerformanceTracking` replaced with `enableAutoPerformanceTracing`.
  * `enableOutOfMemoryTracking` replaced with `enableWatchdogTerminationTracking`.
  * `anrTimeoutIntervalMillis` replaced with `anrTimeoutInterval`.
  * `autoSessionTrackingIntervalMillis` replaced with `autoSessionTrackingInterval`.

* The `enableNdkScopeSync` feature is now enabled by default.

## [Migrating From `sentry_flutter` `6.12.x` to `sentry_flutter` `6.13.x`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-612x-to-sentry_flutter-613x)

The SDK already runs your init `callback` on an error handler, such as [`runZonedGuarded`](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html) on Flutter versions prior to `3.3`, or [`PlatformDispatcher.onError`](https://api.flutter.dev/flutter/dart-ui/PlatformDispatcher/onError.html) on Flutter versions 3.3 and higher, so that errors are automatically captured. No code changes are needed on your part.

## [Migrating From `sentry_flutter` `6.5.x` to `sentry_flutter` `6.6.x`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-65x-to-sentry_flutter-66x)

There are no Flutter-specific breaking changes. However, there are some in [sentry](https://docs.sentry.io/platforms/dart/migration.md) for Dart.

## [Migrating From `sentry_flutter` `6.3.x` to `sentry_flutter` `6.4.x`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-63x-to-sentry_flutter-64x)

To build a Flutter app for Android, Kotlin 1.5.31 or higher is required. If your app uses a lower version, you will receive the following [error message](https://docs.flutter.dev/release/breaking-changes/kotlin-version#summary).

## [Migrating From `sentry_flutter` `5.1.x` to `sentry_flutter` `6.0.0`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-51x-to-sentry_flutter-600)

There are no Flutter specific breaking changes. However there are some in [sentry](https://docs.sentry.io/platforms/dart/migration.md) for Dart.

## [Migrating from `sentry_flutter` `5.0.0` to `sentry_flutter` `5.1.0`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-500-to-sentry_flutter-510)

# [Android specific changes](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#android-specific-changes)

You may remove `android:extractNativeLibs="true"` meta-data in the `AndroidManifest` file or `android.bundle.enableUncompressedNativeLibs=false` in the `gradle.properties` file if you're using the [Android Native Development Kit](https://docs.sentry.io/platforms/android/configuration/using-ndk.md). Sentry can now symbolicate events with the default value of [extractNativeLibs](https://developer.android.com/studio/releases/gradle-plugin#extractNativeLibs) and [android.bundle.enableUncompressedNativeLibs](https://developer.android.com/studio/releases/gradle-plugin#behavior-changes).

A random generated installationId replaces [Settings.Secure.ANDROID\_ID](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID), which has been removed. This may affect the number of unique users displayed on the Issues page and Alerts. If you always set a custom user using Sentry.setUser(customUser), the behavior has not changed. While you don't have to make any update, if you want to maintain the old behavior, use the following code snippet. It makes use of the [device\_info\_plus](https://pub.dev/packages/device_info_plus) plugin:

```dart
import 'package:flutter/foundation.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  await SentryFlutter.init(
    (options) {
      options.dsn = '___PUBLIC_DSN___';
      // revert to old behavior on Android
      if (defaultTargetPlatform == TargetPlatform.android && !kIsWeb) {
        options.addEventProcessor(addAndroidDeviceId);
      }
    },
    // Init your App.
    appRunner: () => runApp(MyApp()),
  );
}

FutureOr<SentryEvent?> addAndroidId(
  SentryEvent event, {
  Hint? hint,
}) async {
  var info = await DeviceInfoPlugin().androidInfo;
  var user = (event.user ?? SentryUser()).copyWith(id: info.androidId);

  return event.copyWith(
    user: user,
  );
}
```

## [Migrating from `sentry_flutter` `4.0.x` to `sentry_flutter` `5.0.0`](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md#migrating-from-sentry_flutter-40x-to-sentry_flutter-500)

In addition to the changes introduced in [sentry](https://docs.sentry.io/platforms/dart/migration.md):

* `SentryFlutterOptions.enableLifecycleBreadcrumbs` was replaced with `SentryFlutterOptions.enableAppLifecycleBreadcrumbs`.
* The Web Plugin Registrant import changed from `import 'package:sentry_flutter/src/sentry_flutter_web.dart';` to `import 'package:sentry_flutter/sentry_flutter_web.dart';`
  * This change may lead to breaking changes. In most cases, however, this change won't lead to breaking changes since the referencing file is auto-generated.
