Native Initialization

Learn how to manually initialize the native SDKs.

By default, the Flutter SDK initializes the native SDK underneath the init method called on the Flutter layer. As a result, the SDK currently has a limitation of not capturing native crashes that occur prior to the init method being called on the Flutter layer. You can initialize the native SDKs yourself to overcome this limitation or if you want to provide custom options above what the Flutter SDK currently provides.

To do this, set autoInitializeNativeSdk to false in the init options:

import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  await SentryFlutter.init(
    (options) => options
      ..dsn = ''
      ..autoInitializeNativeSdk = false,
    appRunner: () => runApp(MyApp()),

This will prevent the Flutter SDK from initializing the native SDKs automatically.

Next, initialize the Android and iOS (using the configuration guide to initialize the Sentry Cocoa SDK) native SDKs. Note that you do not need to install the native SDKs as they are already packaged with the Flutter SDK.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").