-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): Document flutter autoInitializeNativeSdk (#5029)
- Loading branch information
Showing
2 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Native Initialization | ||
sidebar_order: 900 | ||
description: "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 currenty 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](/platforms/flutter/configuration/options/#autoInitializeNativeSdk) to `false` in the init options: | ||
|
||
```dart | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:sentry_flutter/sentry_flutter.dart'; | ||
Future<void> main() async { | ||
await SentryFlutter.init( | ||
(options) => options | ||
..dsn = '___PUBLIC_DSN___' | ||
..autoInitializeNativeSdk = false, | ||
appRunner: () => runApp(MyApp()), | ||
); | ||
} | ||
``` | ||
|
||
This will prevent the Flutter SDK from initializing the native SDKs automatically. | ||
|
||
Next, initialize the [Android](/platforms/android/configuration/manual-init/) and [iOS (using the configuration guide to initialize the Sentry Cocoa SDK)](/platforms/apple/guides/ios/#configure) native SDKs. Note that you do not need to install the native SDKs as they are already packaged with the Flutter SDK. |