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 = 'https://examplePublicKey@o0.ingest.sentry.io/0'
..autoInitializeNativeSdk = false,
appRunner: () => runApp(MyApp()),
);
}
This will prevent the Flutter SDK from initializing the native SDKs automatically.
Next, initialize the native SDKs as specified in the guides below.
- Android
- iOS
- Browser
- For the browser SDK, you will need to inject the loader script manually into your HTML's
<head>
tag.
- For the browser SDK, you will need to inject the loader script manually into your HTML's
Note that you do not need to install the native Android and iOS SDKs as they are already packaged with the Flutter SDK.
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").