Migration Guide

Migrating from sentry_flutter 5.0.0 to sentry_flutter 5.1.0

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. Sentry can now symbolicate events with the default value of extractNativeLibs and android.bundle.enableUncompressedNativeLibs.

A random generated installationId replaces Settings.Secure.ANDROID_ID, which has been removed. This may affect the number of unique users displayed on the 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 plugin:

Copied
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 = 'https://examplePublicKey@o0.ingest.sentry.io/0';
      // 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, {
  dynamic 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

In addition to the changes introduced in sentry:

  • 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.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").