From 95424bef2806f9f5560be39d414f938ad00119d8 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 27 Oct 2020 13:32:07 +0100 Subject: [PATCH 01/55] fix --- src/includes/before-breadcrumb/flutter.mdx | 9 +++++++++ src/includes/breadcrumbs-example/flutter.mdx | 11 +++++++++++ src/platforms/flutter/index.mdx | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 src/includes/before-breadcrumb/flutter.mdx create mode 100644 src/includes/breadcrumbs-example/flutter.mdx diff --git a/src/includes/before-breadcrumb/flutter.mdx b/src/includes/before-breadcrumb/flutter.mdx new file mode 100644 index 0000000000000..ee022cd174e67 --- /dev/null +++ b/src/includes/before-breadcrumb/flutter.mdx @@ -0,0 +1,9 @@ +```dart +import 'package:sentry/sentry.dart'; + +Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { + return 'a.spammy.Logger' == crumb.category ? null : crumb; +} + +Sentry.init((options) => options.beforeBreadcrumbCallback = beforeBreadCrumb); +``` diff --git a/src/includes/breadcrumbs-example/flutter.mdx b/src/includes/breadcrumbs-example/flutter.mdx new file mode 100644 index 0000000000000..9e3560f61c9bd --- /dev/null +++ b/src/includes/breadcrumbs-example/flutter.mdx @@ -0,0 +1,11 @@ +```dart +import 'package:sentry/sentry.dart'; + +Sentry.configureScope((scope) => { + scope.addBreadcrumb(Breadcrumb( + message: 'Authenticated user ${scope.user.email}', + category: 'auth', + level: SentryLevel.info, + )) + }); +``` diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index b8d0d67af207e..044f18be5d7bf 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -6,7 +6,7 @@ Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the f ```yml dependencies: - sentry: ">=3.0.0 <4.0.0" + sentry: ">=4.0.0 <5.0.0" ``` Import `SentryClient` and initialize it: @@ -14,13 +14,13 @@ Import `SentryClient` and initialize it: ```dart import 'package:sentry/sentry.dart'; -final sentry = SentryClient(dsn: "___PUBLIC_DSN___"); +Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); ``` Run the whole app in a zone to capture all uncaught errors: ```dart -import 'dart:async'; +import 'dart:async'; // Wrap your 'runApp(MyApp())' as follows: @@ -28,8 +28,8 @@ void main() async { runZonedGuarded( () => runApp(MyApp()), (error, stackTrace) { - await sentry.captureException( - exception: error, + await Sentry.captureException( + throwable: error, stackTrace: stackTrace, ); }, @@ -41,8 +41,8 @@ Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart FlutterError.onError = (details, {bool forceReport = false}) { - sentry.captureException( - exception: details.exception, + await Sentry.captureException( + throwable: details.exception, stackTrace: details.stack, ); }; @@ -55,8 +55,8 @@ Capture a test exception: try { throw null; } catch (error, stackTrace) { - await sentry.captureException( - exception: error, + await Sentry.captureException( + throwable: error, stackTrace: stackTrace, ); } @@ -65,7 +65,7 @@ try { ### Resources Flutter has extensive documentation, which includes a -[cookbook on how to integrate with Sentry](https://flutter.dev/docs/cookbook/maintenance/error-reporting). +[cookbook on how to integrate with Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). ### Source code From 9e22b478b920abf260a31dc784edcdede6241414 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Tue, 27 Oct 2020 15:50:31 +0100 Subject: [PATCH 02/55] Update src/platforms/flutter/index.mdx Co-authored-by: Bruno Garcia --- src/platforms/flutter/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 044f18be5d7bf..3e7df8cd4ff37 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -6,7 +6,7 @@ Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the f ```yml dependencies: - sentry: ">=4.0.0 <5.0.0" + sentry: ^4.0.0 ``` Import `SentryClient` and initialize it: From 1052fb992987381b94e999debfe1b8ff5158eead Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 09:13:34 +0100 Subject: [PATCH 03/55] added missing docs --- src/includes/before-breadcrumb/flutter.mdx | 10 +++---- src/includes/breadcrumbs-example/flutter.mdx | 26 ++++++++++++------- src/includes/capture-error/flutter.mdx | 25 +++++++++++------- src/includes/capture-message/flutter.mdx | 4 ++- src/includes/configure-scope/flutter.mdx | 11 ++++++++ .../sensitive-data/set-tag/flutter.mdx | 9 +++++++ .../sensitive-data/set-user/flutter.mdx | 10 +++++++ src/includes/set-context/flutter.mdx | 18 ++++++------- src/includes/set-environment/flutter.mdx | 8 ++---- src/includes/set-extra/flutter.mdx | 12 ++++----- .../set-fingerprint/basic/flutter.mdx | 12 +++++++++ .../database-connection/flutter.mdx | 12 +++++++++ src/includes/set-fingerprint/rpc/flutter.mdx | 24 +++++++++++++++++ .../set-fingerprint/static/flutter.mdx | 9 +++++++ src/platforms/flutter/index.mdx | 6 ++--- 15 files changed, 147 insertions(+), 49 deletions(-) create mode 100644 src/includes/configure-scope/flutter.mdx create mode 100644 src/includes/sensitive-data/set-tag/flutter.mdx create mode 100644 src/includes/sensitive-data/set-user/flutter.mdx create mode 100644 src/includes/set-fingerprint/basic/flutter.mdx create mode 100644 src/includes/set-fingerprint/database-connection/flutter.mdx create mode 100644 src/includes/set-fingerprint/rpc/flutter.mdx create mode 100644 src/includes/set-fingerprint/static/flutter.mdx diff --git a/src/includes/before-breadcrumb/flutter.mdx b/src/includes/before-breadcrumb/flutter.mdx index ee022cd174e67..4ba36250c7479 100644 --- a/src/includes/before-breadcrumb/flutter.mdx +++ b/src/includes/before-breadcrumb/flutter.mdx @@ -1,9 +1,9 @@ ```dart -import 'package:sentry/sentry.dart'; + import 'package:sentry/sentry.dart'; -Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { - return 'a.spammy.Logger' == crumb.category ? null : crumb; -} + Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { + return 'a.spammy.Logger' == crumb.category ? null : crumb; + } -Sentry.init((options) => options.beforeBreadcrumbCallback = beforeBreadCrumb); + Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); ``` diff --git a/src/includes/breadcrumbs-example/flutter.mdx b/src/includes/breadcrumbs-example/flutter.mdx index 9e3560f61c9bd..c1ea995c06be0 100644 --- a/src/includes/breadcrumbs-example/flutter.mdx +++ b/src/includes/breadcrumbs-example/flutter.mdx @@ -1,11 +1,19 @@ ```dart -import 'package:sentry/sentry.dart'; - -Sentry.configureScope((scope) => { - scope.addBreadcrumb(Breadcrumb( - message: 'Authenticated user ${scope.user.email}', - category: 'auth', - level: SentryLevel.info, - )) - }); + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + final crumb = Breadcrumb( + message: 'Authenticated user ${scope.user.email}', + category: 'auth', + level: SentryLevel.info, + ); + + scope.addBreadcrumb(crumb); + } + + Sentry.configureScope(scope); + + // or + + Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); ``` diff --git a/src/includes/capture-error/flutter.mdx b/src/includes/capture-error/flutter.mdx index 7b3dac89b1a11..41f6cab5f1b80 100644 --- a/src/includes/capture-error/flutter.mdx +++ b/src/includes/capture-error/flutter.mdx @@ -1,12 +1,19 @@ -In Flutter you can capture any exception object that you caught: +In Dart you can capture any exception object that you want: ```dart -try { - throw null; -} catch (error, stackTrace) { - await sentry.captureException( - exception: error, - stackTrace: stackTrace, - ); -} + import 'package:sentry/sentry.dart'; + + try { + aMethodThatMightFail(); + } catch (exception, stackTrace) { + Sentry.captureException(exception, stackTrace: stackTrace); + } + + // or + + try { + throw 'Not implemented'; + } catch (exception, stackTrace) { + Sentry.captureException(exception, stackTrace: stackTrace); + } ``` diff --git a/src/includes/capture-message/flutter.mdx b/src/includes/capture-message/flutter.mdx index 632d0732347cd..4f039082c8398 100644 --- a/src/includes/capture-message/flutter.mdx +++ b/src/includes/capture-message/flutter.mdx @@ -1,3 +1,5 @@ ```dart -sentry.captureEvent(const Event(message: 'Something went wrong')); + import 'package:sentry/sentry.dart'; + + Sentry.captureMessage('Something went wrong'); ``` diff --git a/src/includes/configure-scope/flutter.mdx b/src/includes/configure-scope/flutter.mdx new file mode 100644 index 0000000000000..655d8c08d1198 --- /dev/null +++ b/src/includes/configure-scope/flutter.mdx @@ -0,0 +1,11 @@ +```java + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.setTag('my-tag', 'my value'); + final user = User(id: '42', email: 'john.doe@example.com'); + scope.user = user; + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/sensitive-data/set-tag/flutter.mdx b/src/includes/sensitive-data/set-tag/flutter.mdx new file mode 100644 index 0000000000000..e243fb4d8dc54 --- /dev/null +++ b/src/includes/sensitive-data/set-tag/flutter.mdx @@ -0,0 +1,9 @@ +```java + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.setTag('birthday', checksumOrHash('08/12/1990')); + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/sensitive-data/set-user/flutter.mdx b/src/includes/sensitive-data/set-user/flutter.mdx new file mode 100644 index 0000000000000..28432b7dc061e --- /dev/null +++ b/src/includes/sensitive-data/set-user/flutter.mdx @@ -0,0 +1,10 @@ +```java + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + final user = User(id: clientUser.id, username: clientUser.username); + scope.user = user; + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/set-context/flutter.mdx b/src/includes/set-context/flutter.mdx index 66e2fd91b7de7..778f9699cb3f0 100644 --- a/src/includes/set-context/flutter.mdx +++ b/src/includes/set-context/flutter.mdx @@ -1,13 +1,11 @@ ```dart -import 'package:sentry/sentry.dart'; + import 'package:sentry/sentry.dart'; -final sentry = SentryClient( - environmentAttributes: const Event( - extra: { - 'name': 'Mighty Fighter', - 'age': 19, - 'attack_type': 'melee', - } - ) -); + void scope(Scope scope) { + scope.setExtra('name', 'Mighty Fighter'); + scope.setExtra('age', 19); + scope.setExtra('attack_type', 'melee'); + } + + Sentry.configureScope(scope); ``` diff --git a/src/includes/set-environment/flutter.mdx b/src/includes/set-environment/flutter.mdx index 043149be2a3cd..45a036aefc493 100644 --- a/src/includes/set-environment/flutter.mdx +++ b/src/includes/set-environment/flutter.mdx @@ -1,9 +1,5 @@ ```dart -import 'package:sentry/sentry.dart'; + import 'package:sentry/sentry.dart'; -final sentry = SentryClient( - environmentAttributes: const Event( - environment: 'production' - ) -); + Sentry.init((options) => options.environment = 'production'); ``` diff --git a/src/includes/set-extra/flutter.mdx b/src/includes/set-extra/flutter.mdx index 94bd12edbe19a..16bb01fcf8ef4 100644 --- a/src/includes/set-extra/flutter.mdx +++ b/src/includes/set-extra/flutter.mdx @@ -1,9 +1,9 @@ ```dart -import 'package:sentry/sentry.dart'; + import 'package:sentry/sentry.dart'; -final sentry = SentryClient( - environmentAttributes: const Event( - extra: { 'character.name': 'Mighty Fighter' } - ) -); + void scope(Scope scope) { + scope.setExtra('character.name', 'Mighty Fighter'); + } + + Sentry.configureScope(scope); ``` diff --git a/src/includes/set-fingerprint/basic/flutter.mdx b/src/includes/set-fingerprint/basic/flutter.mdx new file mode 100644 index 0000000000000..a823e4114ca31 --- /dev/null +++ b/src/includes/set-fingerprint/basic/flutter.mdx @@ -0,0 +1,12 @@ +```dart + import 'package:sentry/sentry.dart'; + + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); + } + return event; + } + + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/set-fingerprint/database-connection/flutter.mdx b/src/includes/set-fingerprint/database-connection/flutter.mdx new file mode 100644 index 0000000000000..a823e4114ca31 --- /dev/null +++ b/src/includes/set-fingerprint/database-connection/flutter.mdx @@ -0,0 +1,12 @@ +```dart + import 'package:sentry/sentry.dart'; + + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); + } + return event; + } + + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/set-fingerprint/rpc/flutter.mdx b/src/includes/set-fingerprint/rpc/flutter.mdx new file mode 100644 index 0000000000000..9f07f39cffed0 --- /dev/null +++ b/src/includes/set-fingerprint/rpc/flutter.mdx @@ -0,0 +1,24 @@ +```dart + import 'package:sentry/sentry.dart'; + + class MyRpcException implements Exception { + final String function; + final int httpStatusCode; + + MyRpcException(this.function, this.httpStatusCode); + } + + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is MyRpcException) { + final exception = event.exception as MyRpcException; + event = event.copyWith(fingerprint: [ + '{{ default }}', + exception.function, + exception.httpStatusCode.toString(), + ]); + } + return event; + } + + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/set-fingerprint/static/flutter.mdx b/src/includes/set-fingerprint/static/flutter.mdx new file mode 100644 index 0000000000000..5c4b85a448c36 --- /dev/null +++ b/src/includes/set-fingerprint/static/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.fingerprint = ['auth-error']; + } + + Sentry.configureScope(scope); +``` diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 3e7df8cd4ff37..322ab28757d77 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -29,7 +29,7 @@ void main() async { () => runApp(MyApp()), (error, stackTrace) { await Sentry.captureException( - throwable: error, + exception: error, stackTrace: stackTrace, ); }, @@ -42,7 +42,7 @@ Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart FlutterError.onError = (details, {bool forceReport = false}) { await Sentry.captureException( - throwable: details.exception, + exception: details.exception, stackTrace: details.stack, ); }; @@ -56,7 +56,7 @@ try { throw null; } catch (error, stackTrace) { await Sentry.captureException( - throwable: error, + exception: error, stackTrace: stackTrace, ); } From 2e0feb34a7bca1020b02a04537c74670d0909518 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 28 Oct 2020 09:17:39 +0100 Subject: [PATCH 04/55] Update src/includes/configure-scope/flutter.mdx --- src/includes/configure-scope/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/configure-scope/flutter.mdx b/src/includes/configure-scope/flutter.mdx index 655d8c08d1198..91ee1ea51245f 100644 --- a/src/includes/configure-scope/flutter.mdx +++ b/src/includes/configure-scope/flutter.mdx @@ -1,4 +1,4 @@ -```java +```dart import 'package:sentry/sentry.dart'; void scope(Scope scope) { From 07c46c014e7f195b305baaeb9e049a78d6d1d3da Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 28 Oct 2020 09:18:07 +0100 Subject: [PATCH 05/55] Update src/includes/sensitive-data/set-tag/flutter.mdx --- src/includes/sensitive-data/set-tag/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/sensitive-data/set-tag/flutter.mdx b/src/includes/sensitive-data/set-tag/flutter.mdx index e243fb4d8dc54..7aebf079e7206 100644 --- a/src/includes/sensitive-data/set-tag/flutter.mdx +++ b/src/includes/sensitive-data/set-tag/flutter.mdx @@ -1,4 +1,4 @@ -```java +```dart import 'package:sentry/sentry.dart'; void scope(Scope scope) { From 72bd0b0d397a8e80a3cf4b75127a5e82ed590e63 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 28 Oct 2020 09:18:25 +0100 Subject: [PATCH 06/55] Update src/includes/sensitive-data/set-user/flutter.mdx --- src/includes/sensitive-data/set-user/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/sensitive-data/set-user/flutter.mdx b/src/includes/sensitive-data/set-user/flutter.mdx index 28432b7dc061e..4dd5cb9c8f78f 100644 --- a/src/includes/sensitive-data/set-user/flutter.mdx +++ b/src/includes/sensitive-data/set-user/flutter.mdx @@ -1,4 +1,4 @@ -```java +```dart import 'package:sentry/sentry.dart'; void scope(Scope scope) { From c3f4863723e6d7705caf7d6db7c62a7ece07debe Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 09:20:17 +0100 Subject: [PATCH 07/55] fix --- src/includes/capture-error/flutter.mdx | 2 +- src/platforms/flutter/index.mdx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/includes/capture-error/flutter.mdx b/src/includes/capture-error/flutter.mdx index 41f6cab5f1b80..56583a1fef15d 100644 --- a/src/includes/capture-error/flutter.mdx +++ b/src/includes/capture-error/flutter.mdx @@ -1,4 +1,4 @@ -In Dart you can capture any exception object that you want: +In Dart you can capture any exception object that you caught: ```dart import 'package:sentry/sentry.dart'; diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 322ab28757d77..1ee79a4edc1fd 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -28,7 +28,7 @@ void main() async { runZonedGuarded( () => runApp(MyApp()), (error, stackTrace) { - await Sentry.captureException( + Sentry.captureException( exception: error, stackTrace: stackTrace, ); @@ -41,7 +41,7 @@ Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart FlutterError.onError = (details, {bool forceReport = false}) { - await Sentry.captureException( + Sentry.captureException( exception: details.exception, stackTrace: details.stack, ); @@ -55,7 +55,7 @@ Capture a test exception: try { throw null; } catch (error, stackTrace) { - await Sentry.captureException( + Sentry.captureException( exception: error, stackTrace: stackTrace, ); From 32873b36f5861a648d1bf4a1965b7fa908a17e1c Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 09:58:02 +0100 Subject: [PATCH 08/55] added missing docs --- src/includes/configuration/sample-rate/flutter.mdx | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/includes/configuration/sample-rate/flutter.mdx diff --git a/src/includes/configuration/sample-rate/flutter.mdx b/src/includes/configuration/sample-rate/flutter.mdx new file mode 100644 index 0000000000000..dc14382c07840 --- /dev/null +++ b/src/includes/configuration/sample-rate/flutter.mdx @@ -0,0 +1,5 @@ +```dart + import 'package:sentry/sentry.dart'; + + Sentry.init((options) => options.sampleRate = 0.25); +``` From f0e684475d342e9ed9320d15d2fa46d9489fc6bf Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 10:10:04 +0100 Subject: [PATCH 09/55] fix --- src/includes/set-fingerprint/static/flutter.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/includes/set-fingerprint/static/flutter.mdx b/src/includes/set-fingerprint/static/flutter.mdx index 5c4b85a448c36..dd0492e116e9e 100644 --- a/src/includes/set-fingerprint/static/flutter.mdx +++ b/src/includes/set-fingerprint/static/flutter.mdx @@ -1,9 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.fingerprint = ['auth-error']; - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']); ``` From 449c51e0aecf529f4db30683e6d4613e0240fddc Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 10:16:53 +0100 Subject: [PATCH 10/55] fix --- .../before-breadcrumb-hint/flutter.mdx | 9 +++++++++ .../before-send-fingerprint/flutter.mdx | 10 ++++++++++ .../configuration/before-send-hint/flutter.mdx | 11 +++++++++++ .../configuration/before-send/flutter.mdx | 13 +++++++++++++ .../configuration/config-intro/flutter.mdx | 16 ++++++++-------- src/includes/sensitive-data/set-tag/flutter.mdx | 9 ++++----- src/includes/sensitive-data/set-user/flutter.mdx | 10 ++++------ src/includes/set-extra/flutter.mdx | 9 ++++----- src/includes/set-level/flutter.mdx | 9 +++++++++ src/includes/set-release/flutter.mdx | 8 ++------ src/includes/set-tag/flutter.mdx | 9 +++++++++ src/includes/set-user/flutter.mdx | 9 +++++++++ src/includes/unset-user/flutter.mdx | 9 +++++++++ 13 files changed, 101 insertions(+), 30 deletions(-) create mode 100644 src/includes/configuration/before-breadcrumb-hint/flutter.mdx create mode 100644 src/includes/configuration/before-send-fingerprint/flutter.mdx create mode 100644 src/includes/configuration/before-send-hint/flutter.mdx create mode 100644 src/includes/configuration/before-send/flutter.mdx create mode 100644 src/includes/set-level/flutter.mdx create mode 100644 src/includes/set-tag/flutter.mdx create mode 100644 src/includes/set-user/flutter.mdx create mode 100644 src/includes/unset-user/flutter.mdx diff --git a/src/includes/configuration/before-breadcrumb-hint/flutter.mdx b/src/includes/configuration/before-breadcrumb-hint/flutter.mdx new file mode 100644 index 0000000000000..2216c11f36453 --- /dev/null +++ b/src/includes/configuration/before-breadcrumb-hint/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { + return hint is MyHint ? null : crumb; + } + + Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); +``` diff --git a/src/includes/configuration/before-send-fingerprint/flutter.mdx b/src/includes/configuration/before-send-fingerprint/flutter.mdx new file mode 100644 index 0000000000000..2fb6b891e0af5 --- /dev/null +++ b/src/includes/configuration/before-send-fingerprint/flutter.mdx @@ -0,0 +1,10 @@ +```dart + import 'package:sentry/sentry.dart'; + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); + } + return event; + } + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/configuration/before-send-hint/flutter.mdx b/src/includes/configuration/before-send-hint/flutter.mdx new file mode 100644 index 0000000000000..59f22ea7ca787 --- /dev/null +++ b/src/includes/configuration/before-send-hint/flutter.mdx @@ -0,0 +1,11 @@ +A `BiFunction` can be used to mutate, discard (return null), or return a completely new event. + +```dart + import 'package:sentry/sentry.dart'; + + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + return hint is MyHint ? null : event; + } + + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/configuration/before-send/flutter.mdx b/src/includes/configuration/before-send/flutter.mdx new file mode 100644 index 0000000000000..a487c968f85f9 --- /dev/null +++ b/src/includes/configuration/before-send/flutter.mdx @@ -0,0 +1,13 @@ +A `BiFunction` can be used to mutate, discard (return null), or return a completely new event. + +```dart + import 'package:sentry/sentry.dart'; + + SentryEvent beforeSend(SentryEvent event, dynamic hint) { + // Modify the event here: + event = event.copyWith(serverName: null); // Don't send server names. + return event; + } + + Sentry.init((options) => options.beforeSend = beforeSend); +``` diff --git a/src/includes/configuration/config-intro/flutter.mdx b/src/includes/configuration/config-intro/flutter.mdx index 7a070fa366cd7..2a5b6b650c2af 100644 --- a/src/includes/configuration/config-intro/flutter.mdx +++ b/src/includes/configuration/config-intro/flutter.mdx @@ -1,11 +1,11 @@ -Options are passed to the `SentryClient()` class: +Options are passed to the `Sentry.init` method: ```dart -final sentry = SentryClient( - dsn: '___PUBLIC_DSN___', - environmentAttributes: const Event( - release: 'my-project-name@2.3.12', - environment: 'production', - ) -); + void options(SentryOptions options) { + options.dsn = '___PUBLIC_DSN___'; + options.release = 'my-project-name@2.3.12'; + options.environment = 'production'; + } + + Sentry.init(options); ``` diff --git a/src/includes/sensitive-data/set-tag/flutter.mdx b/src/includes/sensitive-data/set-tag/flutter.mdx index 7aebf079e7206..63e747c55c947 100644 --- a/src/includes/sensitive-data/set-tag/flutter.mdx +++ b/src/includes/sensitive-data/set-tag/flutter.mdx @@ -1,9 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.setTag('birthday', checksumOrHash('08/12/1990')); - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.setTag( + 'birthday', + checksumOrHash('08/12/1990'), + )); ``` diff --git a/src/includes/sensitive-data/set-user/flutter.mdx b/src/includes/sensitive-data/set-user/flutter.mdx index 4dd5cb9c8f78f..4606a443263f0 100644 --- a/src/includes/sensitive-data/set-user/flutter.mdx +++ b/src/includes/sensitive-data/set-user/flutter.mdx @@ -1,10 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - final user = User(id: clientUser.id, username: clientUser.username); - scope.user = user; - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.user = User( + id: clientUser.id, + username: clientUser.username, + )); ``` diff --git a/src/includes/set-extra/flutter.mdx b/src/includes/set-extra/flutter.mdx index 16bb01fcf8ef4..a92261972cbe8 100644 --- a/src/includes/set-extra/flutter.mdx +++ b/src/includes/set-extra/flutter.mdx @@ -1,9 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.setExtra('character.name', 'Mighty Fighter'); - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.setExtra( + 'character.name', + 'Mighty Fighter', + )); ``` diff --git a/src/includes/set-level/flutter.mdx b/src/includes/set-level/flutter.mdx new file mode 100644 index 0000000000000..734e97d600100 --- /dev/null +++ b/src/includes/set-level/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.level = SentryLevel.warning; + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/set-release/flutter.mdx b/src/includes/set-release/flutter.mdx index 81d8849e17adc..2779cf09f2176 100644 --- a/src/includes/set-release/flutter.mdx +++ b/src/includes/set-release/flutter.mdx @@ -1,9 +1,5 @@ ```dart -import 'package:sentry/sentry.dart'; + import 'package:sentry/sentry.dart'; -final sentry = SentryClient( - environmentAttributes: const Event( - release: 'my-project-name@2.3.12' - ) -); + Sentry.init((options) => options.release = 'my-project-name@2.3.12'); ``` diff --git a/src/includes/set-tag/flutter.mdx b/src/includes/set-tag/flutter.mdx new file mode 100644 index 0000000000000..2fa3df5d50ffe --- /dev/null +++ b/src/includes/set-tag/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.setTag('page.locale', 'de-at'); + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/set-user/flutter.mdx b/src/includes/set-user/flutter.mdx new file mode 100644 index 0000000000000..898a805c44ff2 --- /dev/null +++ b/src/includes/set-user/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.user = User(email: 'jane.doe@example.com'); + } + + Sentry.configureScope(scope); +``` diff --git a/src/includes/unset-user/flutter.mdx b/src/includes/unset-user/flutter.mdx new file mode 100644 index 0000000000000..db5f4022d4cc7 --- /dev/null +++ b/src/includes/unset-user/flutter.mdx @@ -0,0 +1,9 @@ +```dart + import 'package:sentry/sentry.dart'; + + void scope(Scope scope) { + scope.user = null; + } + + Sentry.configureScope(scope); +``` From 3f4ebfef94a0b4bb1c95b83454fc9921a935a55e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 10:42:29 +0100 Subject: [PATCH 11/55] fix --- .../getting-started-config/flutter.mdx | 5 ++++ .../getting-started-install/flutter.mdx | 4 +++ .../getting-started-verify/flutter.mdx | 11 ++++++++ src/platforms/flutter/index.mdx | 25 +++-------------- src/wizard/flutter/index.md | 27 ++++--------------- 5 files changed, 29 insertions(+), 43 deletions(-) create mode 100644 src/includes/getting-started-config/flutter.mdx create mode 100644 src/includes/getting-started-install/flutter.mdx create mode 100644 src/includes/getting-started-verify/flutter.mdx diff --git a/src/includes/getting-started-config/flutter.mdx b/src/includes/getting-started-config/flutter.mdx new file mode 100644 index 0000000000000..3819dfd688f18 --- /dev/null +++ b/src/includes/getting-started-config/flutter.mdx @@ -0,0 +1,5 @@ +```dart + import 'package:sentry/sentry.dart'; + + Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); +``` diff --git a/src/includes/getting-started-install/flutter.mdx b/src/includes/getting-started-install/flutter.mdx new file mode 100644 index 0000000000000..81ad6aa660b69 --- /dev/null +++ b/src/includes/getting-started-install/flutter.mdx @@ -0,0 +1,4 @@ +```yml {filename:pubspec.yaml} +dependencies: + sentry: ^4.0.0 +``` diff --git a/src/includes/getting-started-verify/flutter.mdx b/src/includes/getting-started-verify/flutter.mdx new file mode 100644 index 0000000000000..5db10bb94f84e --- /dev/null +++ b/src/includes/getting-started-verify/flutter.mdx @@ -0,0 +1,11 @@ +```dart +// Throw an exception and capture it with the Sentry client: +try { + throw null; +} catch (error, stackTrace) { + Sentry.captureException( + exception: error, + stackTrace: stackTrace, + ); +} +``` diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 1ee79a4edc1fd..841fc8040c623 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -4,18 +4,11 @@ title: Flutter Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: -```yml -dependencies: - sentry: ^4.0.0 -``` + -Import `SentryClient` and initialize it: +Import `Sentry` and initialize it: -```dart -import 'package:sentry/sentry.dart'; - -Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); -``` + Run the whole app in a zone to capture all uncaught errors: @@ -50,17 +43,7 @@ FlutterError.onError = (details, {bool forceReport = false}) { Capture a test exception: -```dart -// Throw an exception and capture it with the Sentry client: -try { - throw null; -} catch (error, stackTrace) { - Sentry.captureException( - exception: error, - stackTrace: stackTrace, - ); -} -``` + ### Resources diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 23c5bd43b8999..2792c66bddf92 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -7,23 +7,16 @@ type: framework Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: -```yml -dependencies: - sentry: ">=3.0.0 <4.0.0" -``` - -Import `SentryClient` and initialize it: + -```dart -import 'package:sentry/sentry.dart'; +Import `Sentry` and initialize it: -final sentry = SentryClient(dsn: "___PUBLIC_DSN___"); -``` + Run the whole app in a zone to capture all uncaught errors: ```dart -import 'dart:async'; +import 'dart:async'; // Wrap your 'runApp(MyApp())' as follows: @@ -53,17 +46,7 @@ FlutterError.onError = (details, {bool forceReport = false}) { Capture a test exception: -```dart -// Throw an exception and capture it with the Sentry client: -try { - throw null; -} catch (error, stackTrace) { - await sentry.captureException( - exception: error, - stackTrace: stackTrace, - ); -} -``` + ### Resources From 749de8c78af769eb6da236d7a3bb95125cf39d11 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 10:46:18 +0100 Subject: [PATCH 12/55] wizard --- src/platforms/flutter/index.mdx | 3 +++ src/wizard/flutter/index.md | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 841fc8040c623..0ff1eca7efbe3 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -14,6 +14,7 @@ Run the whole app in a zone to capture all uncaught errors: ```dart import 'dart:async'; +import 'package:sentry/sentry.dart'; // Wrap your 'runApp(MyApp())' as follows: @@ -33,6 +34,8 @@ void main() async { Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart +import 'package:sentry/sentry.dart'; + FlutterError.onError = (details, {bool forceReport = false}) { Sentry.captureException( exception: details.exception, diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 2792c66bddf92..98da31cb415a4 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -17,6 +17,7 @@ Run the whole app in a zone to capture all uncaught errors: ```dart import 'dart:async'; +import 'package:sentry/sentry.dart'; // Wrap your 'runApp(MyApp())' as follows: @@ -24,7 +25,7 @@ void main() async { runZonedGuarded( () => runApp(MyApp()), (error, stackTrace) { - await sentry.captureException( + Sentry.captureException( exception: error, stackTrace: stackTrace, ); @@ -36,8 +37,10 @@ void main() async { Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart +import 'package:sentry/sentry.dart'; + FlutterError.onError = (details, {bool forceReport = false}) { - sentry.captureException( + Sentry.captureException( exception: details.exception, stackTrace: details.stack, ); @@ -51,10 +54,8 @@ Capture a test exception: ### Resources Flutter has extensive documentation, which includes a -[cookbook on how to integrate with Sentry](https://flutter.dev/docs/cookbook/maintenance/error-reporting). +[cookbook on how to integrate with Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). ### Source code -The Sentry SDK is part of the [Flutter organization on GitHub](https://github.com/flutter/sentry). -Sentry is working on improving the Flutter integration on top of the core Dart SDK -through [`sentry-flutter`](https://github.com/getsentry/sentry-flutter/). +The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). From b5acf5b74f2ba8fc7d6dac2b5589adba5859912e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 11:38:13 +0100 Subject: [PATCH 13/55] fixes --- .../configuration/before-send-fingerprint/flutter.mdx | 2 ++ src/includes/set-level/flutter.mdx | 6 +----- src/includes/set-tag/flutter.mdx | 6 +----- src/includes/set-user/flutter.mdx | 6 +----- src/includes/unset-user/flutter.mdx | 6 +----- src/wizard/flutter/index.md | 1 + 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/includes/configuration/before-send-fingerprint/flutter.mdx b/src/includes/configuration/before-send-fingerprint/flutter.mdx index 2fb6b891e0af5..a823e4114ca31 100644 --- a/src/includes/configuration/before-send-fingerprint/flutter.mdx +++ b/src/includes/configuration/before-send-fingerprint/flutter.mdx @@ -1,10 +1,12 @@ ```dart import 'package:sentry/sentry.dart'; + SentryEvent beforeSend(SentryEvent event, dynamic hint) { if (event.exception is DatabaseException) { event = event.copyWith(fingerprint: ['database-connection-error']); } return event; } + Sentry.init((options) => options.beforeSend = beforeSend); ``` diff --git a/src/includes/set-level/flutter.mdx b/src/includes/set-level/flutter.mdx index 734e97d600100..9e23e9c6ee368 100644 --- a/src/includes/set-level/flutter.mdx +++ b/src/includes/set-level/flutter.mdx @@ -1,9 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.level = SentryLevel.warning; - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.level = SentryLevel.warning); ``` diff --git a/src/includes/set-tag/flutter.mdx b/src/includes/set-tag/flutter.mdx index 2fa3df5d50ffe..b41a320e40781 100644 --- a/src/includes/set-tag/flutter.mdx +++ b/src/includes/set-tag/flutter.mdx @@ -1,9 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.setTag('page.locale', 'de-at'); - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.setTag('page.locale', 'de-at')); ``` diff --git a/src/includes/set-user/flutter.mdx b/src/includes/set-user/flutter.mdx index 898a805c44ff2..9b33ea0654111 100644 --- a/src/includes/set-user/flutter.mdx +++ b/src/includes/set-user/flutter.mdx @@ -1,9 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.user = User(email: 'jane.doe@example.com'); - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.user = User(email: 'jane.doe@example.com')); ``` diff --git a/src/includes/unset-user/flutter.mdx b/src/includes/unset-user/flutter.mdx index db5f4022d4cc7..b39ebb39a71fc 100644 --- a/src/includes/unset-user/flutter.mdx +++ b/src/includes/unset-user/flutter.mdx @@ -1,9 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.user = null; - } - - Sentry.configureScope(scope); + Sentry.configureScope((scope) => scope.user = null); ``` diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 98da31cb415a4..5640563e030b3 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -37,6 +37,7 @@ void main() async { Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart +import 'package:flutter/foundation.dart'; import 'package:sentry/sentry.dart'; FlutterError.onError = (details, {bool forceReport = false}) { From 6118def3b7ea356c2604ccbcf1843de4db50b46e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 28 Oct 2020 13:06:30 +0100 Subject: [PATCH 14/55] import --- src/platforms/flutter/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 0ff1eca7efbe3..b9c597b366b7d 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -34,6 +34,7 @@ void main() async { Catch Flutter specific errors by subscribing to `FlutterError.onError`: ```dart +import 'package:flutter/foundation.dart'; import 'package:sentry/sentry.dart'; FlutterError.onError = (details, {bool forceReport = false}) { From 5e19fcd24f169da11ac2ecda94e1cc97ea156893 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 28 Oct 2020 15:40:23 +0100 Subject: [PATCH 15/55] Update src/platforms/flutter/index.mdx --- src/platforms/flutter/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index b9c597b366b7d..50a6c6f28614c 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -22,7 +22,7 @@ void main() async { runZonedGuarded( () => runApp(MyApp()), (error, stackTrace) { - Sentry.captureException( + await Sentry.captureException( exception: error, stackTrace: stackTrace, ); From e68c58501f802b4cf85f42f3e4a93e274c805108 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 28 Oct 2020 15:41:00 +0100 Subject: [PATCH 16/55] Update src/wizard/flutter/index.md --- src/wizard/flutter/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 5640563e030b3..40787991dea9a 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -25,7 +25,7 @@ void main() async { runZonedGuarded( () => runApp(MyApp()), (error, stackTrace) { - Sentry.captureException( + await Sentry.captureException( exception: error, stackTrace: stackTrace, ); From c97b4a2fdd09909f6cc786f4b612c65f33264129 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 08:54:31 +0100 Subject: [PATCH 17/55] Update src/includes/configuration/config-intro/flutter.mdx Co-authored-by: Bruno Garcia --- src/includes/configuration/config-intro/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/configuration/config-intro/flutter.mdx b/src/includes/configuration/config-intro/flutter.mdx index 2a5b6b650c2af..f75137a7287a3 100644 --- a/src/includes/configuration/config-intro/flutter.mdx +++ b/src/includes/configuration/config-intro/flutter.mdx @@ -4,7 +4,7 @@ Options are passed to the `Sentry.init` method: void options(SentryOptions options) { options.dsn = '___PUBLIC_DSN___'; options.release = 'my-project-name@2.3.12'; - options.environment = 'production'; + options.environment = 'staging'; } Sentry.init(options); From be0c372573cb6a7d13721b8df8d10e62bd32fbc2 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 08:55:02 +0100 Subject: [PATCH 18/55] Update src/includes/configuration/sample-rate/flutter.mdx Co-authored-by: Bruno Garcia --- src/includes/configuration/sample-rate/flutter.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/includes/configuration/sample-rate/flutter.mdx b/src/includes/configuration/sample-rate/flutter.mdx index dc14382c07840..7029f9dca9535 100644 --- a/src/includes/configuration/sample-rate/flutter.mdx +++ b/src/includes/configuration/sample-rate/flutter.mdx @@ -1,5 +1,6 @@ ```dart import 'package:sentry/sentry.dart'; + // Capture only 25% of events Sentry.init((options) => options.sampleRate = 0.25); ``` From dde61c9c65a6283042bc40c4390b528c1eae55aa Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 08:55:28 +0100 Subject: [PATCH 19/55] Update src/includes/set-tag/flutter.mdx Co-authored-by: Bruno Garcia --- src/includes/set-tag/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/set-tag/flutter.mdx b/src/includes/set-tag/flutter.mdx index b41a320e40781..651ee9aa6195a 100644 --- a/src/includes/set-tag/flutter.mdx +++ b/src/includes/set-tag/flutter.mdx @@ -1,5 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - Sentry.configureScope((scope) => scope.setTag('page.locale', 'de-at')); + Sentry.configureScope((scope) => scope.setTag('page.locale', 'pt-BR')); ``` From db8514a4da5c66a8aa79de4e671333a8566c05f9 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 08:57:35 +0100 Subject: [PATCH 20/55] Update src/includes/set-environment/flutter.mdx --- src/includes/set-environment/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/set-environment/flutter.mdx b/src/includes/set-environment/flutter.mdx index 45a036aefc493..38140c63fbe9b 100644 --- a/src/includes/set-environment/flutter.mdx +++ b/src/includes/set-environment/flutter.mdx @@ -1,5 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - Sentry.init((options) => options.environment = 'production'); + Sentry.init((options) => options.environment = 'staging'); ``` From 82b5a62323c90664e16daec840d44ae002596ae5 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 20:51:15 +0100 Subject: [PATCH 21/55] Update src/platforms/flutter/index.mdx Co-authored-by: Tien "Mimi" Nguyen --- src/platforms/flutter/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 50a6c6f28614c..836bad663e264 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -52,7 +52,7 @@ Capture a test exception: ### Resources Flutter has extensive documentation, which includes a -[cookbook on how to integrate with Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). +[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). ### Source code From b122ad41589d6e5fcd55d6a5b67b39b8334e9d40 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 29 Oct 2020 20:51:40 +0100 Subject: [PATCH 22/55] Update src/platforms/flutter/index.mdx Co-authored-by: Tien "Mimi" Nguyen --- src/platforms/flutter/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 836bad663e264..577a5108a1d16 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -51,7 +51,7 @@ Capture a test exception: ### Resources -Flutter has extensive documentation, which includes a +Flutter has extensive documentation, including a [cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). ### Source code From 2bdfb17d82a39f204c73141e59557772cb47126e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:00:22 +0100 Subject: [PATCH 23/55] Update src/includes/capture-error/flutter.mdx --- src/includes/capture-error/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/capture-error/flutter.mdx b/src/includes/capture-error/flutter.mdx index 56583a1fef15d..ec1b31f9b2136 100644 --- a/src/includes/capture-error/flutter.mdx +++ b/src/includes/capture-error/flutter.mdx @@ -6,7 +6,7 @@ In Dart you can capture any exception object that you caught: try { aMethodThatMightFail(); } catch (exception, stackTrace) { - Sentry.captureException(exception, stackTrace: stackTrace); + await Sentry.captureException(exception, stackTrace: stackTrace); } // or From ec5cc38aa8f0568fc10592f94099714acd3a31c9 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:00:49 +0100 Subject: [PATCH 24/55] Update src/includes/capture-error/flutter.mdx --- src/includes/capture-error/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/capture-error/flutter.mdx b/src/includes/capture-error/flutter.mdx index ec1b31f9b2136..718e56d8f5a55 100644 --- a/src/includes/capture-error/flutter.mdx +++ b/src/includes/capture-error/flutter.mdx @@ -14,6 +14,6 @@ In Dart you can capture any exception object that you caught: try { throw 'Not implemented'; } catch (exception, stackTrace) { - Sentry.captureException(exception, stackTrace: stackTrace); + await Sentry.captureException(exception, stackTrace: stackTrace); } ``` From c0f1b6a220db95b6e1ce0eab87cc7bcd3d935d52 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:01:07 +0100 Subject: [PATCH 25/55] Update src/includes/capture-message/flutter.mdx --- src/includes/capture-message/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/capture-message/flutter.mdx b/src/includes/capture-message/flutter.mdx index 4f039082c8398..e95a20ba42af1 100644 --- a/src/includes/capture-message/flutter.mdx +++ b/src/includes/capture-message/flutter.mdx @@ -1,5 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; - Sentry.captureMessage('Something went wrong'); + await Sentry.captureMessage('Something went wrong'); ``` From 15f0de23e588c683a9e7564235f5cb5995f06489 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:01:40 +0100 Subject: [PATCH 26/55] Update src/includes/getting-started-verify/flutter.mdx Co-authored-by: Bruno Garcia --- src/includes/getting-started-verify/flutter.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/getting-started-verify/flutter.mdx b/src/includes/getting-started-verify/flutter.mdx index 5db10bb94f84e..c998fdf023c2b 100644 --- a/src/includes/getting-started-verify/flutter.mdx +++ b/src/includes/getting-started-verify/flutter.mdx @@ -3,7 +3,7 @@ try { throw null; } catch (error, stackTrace) { - Sentry.captureException( + await Sentry.captureException( exception: error, stackTrace: stackTrace, ); From e22b3a8a6abef3cbdbc693893e6180a80c7e816b Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:04:31 +0100 Subject: [PATCH 27/55] Update src/includes/set-user/flutter.mdx --- src/includes/set-user/flutter.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/includes/set-user/flutter.mdx b/src/includes/set-user/flutter.mdx index 9b33ea0654111..f8671ea4ff357 100644 --- a/src/includes/set-user/flutter.mdx +++ b/src/includes/set-user/flutter.mdx @@ -1,5 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; - Sentry.configureScope((scope) => scope.user = User(email: 'jane.doe@example.com')); + Sentry.configureScope( + (scope) => scope.user = User(email: 'jane.doe@example.com'), + ); ``` From 1158de10d75df4d3c9b5f1ad28de3ef4571b0271 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Fri, 30 Oct 2020 15:26:50 +0100 Subject: [PATCH 28/55] Update src/includes/getting-started-verify/flutter.mdx --- src/includes/getting-started-verify/flutter.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/includes/getting-started-verify/flutter.mdx b/src/includes/getting-started-verify/flutter.mdx index c998fdf023c2b..c4be6f6d8d20f 100644 --- a/src/includes/getting-started-verify/flutter.mdx +++ b/src/includes/getting-started-verify/flutter.mdx @@ -2,9 +2,9 @@ // Throw an exception and capture it with the Sentry client: try { throw null; -} catch (error, stackTrace) { +} catch (exception, stackTrace) { await Sentry.captureException( - exception: error, + exception, stackTrace: stackTrace, ); } From f68660fcfe954d294f851ee91af61811231752c4 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Fri, 30 Oct 2020 15:28:51 +0100 Subject: [PATCH 29/55] fix examples --- src/platforms/flutter/index.mdx | 34 +++++++++++++++++---------------- src/wizard/flutter/index.md | 34 +++++++++++++++++---------------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 577a5108a1d16..3829004ce22db 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -14,20 +14,20 @@ Run the whole app in a zone to capture all uncaught errors: ```dart import 'dart:async'; +import 'package:flutter/widgets.dart'; import 'package:sentry/sentry.dart'; // Wrap your 'runApp(MyApp())' as follows: -void main() async { - runZonedGuarded( - () => runApp(MyApp()), - (error, stackTrace) { - await Sentry.captureException( - exception: error, - stackTrace: stackTrace, - ); - }, - ); +void main() { + runZonedGuarded(() { + runApp(MyApp()); + }, (exception, stackTrace) async { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); + }); } ``` @@ -37,12 +37,14 @@ Catch Flutter specific errors by subscribing to `FlutterError.onError`: import 'package:flutter/foundation.dart'; import 'package:sentry/sentry.dart'; -FlutterError.onError = (details, {bool forceReport = false}) { - Sentry.captureException( - exception: details.exception, - stackTrace: details.stack, - ); -}; +void main() { + FlutterError.onError = (FlutterErrorDetails details) async { + await Sentry.captureException( + details.exception, + stackTrace: details.stack, + ); + }; +} ``` Capture a test exception: diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 40787991dea9a..ecf17b7f09e92 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -17,20 +17,20 @@ Run the whole app in a zone to capture all uncaught errors: ```dart import 'dart:async'; +import 'package:flutter/widgets.dart'; import 'package:sentry/sentry.dart'; // Wrap your 'runApp(MyApp())' as follows: -void main() async { - runZonedGuarded( - () => runApp(MyApp()), - (error, stackTrace) { - await Sentry.captureException( - exception: error, - stackTrace: stackTrace, - ); - }, - ); +void main() { + runZonedGuarded(() { + runApp(MyApp()); + }, (exception, stackTrace) async { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); + }); } ``` @@ -40,12 +40,14 @@ Catch Flutter specific errors by subscribing to `FlutterError.onError`: import 'package:flutter/foundation.dart'; import 'package:sentry/sentry.dart'; -FlutterError.onError = (details, {bool forceReport = false}) { - Sentry.captureException( - exception: details.exception, - stackTrace: details.stack, - ); -}; +void main() { + FlutterError.onError = (FlutterErrorDetails details) async { + await Sentry.captureException( + details.exception, + stackTrace: details.stack, + ); + }; +} ``` Capture a test exception: From a8ebb39ac0c02072e6d5c163aef478e2f1a45cca Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 14:06:57 +0100 Subject: [PATCH 30/55] add new platform --- src/platforms/dart/config.yml | 4 ++++ src/platforms/flutter/config.yml | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/platforms/dart/config.yml diff --git a/src/platforms/dart/config.yml b/src/platforms/dart/config.yml new file mode 100644 index 0000000000000..d0e4ae1e10c60 --- /dev/null +++ b/src/platforms/dart/config.yml @@ -0,0 +1,4 @@ +title: Dart +caseStyle: canonical +supportLevel: production +sdk: sentry.dart diff --git a/src/platforms/flutter/config.yml b/src/platforms/flutter/config.yml index 960e7644f9877..a357696967f04 100644 --- a/src/platforms/flutter/config.yml +++ b/src/platforms/flutter/config.yml @@ -1,3 +1,5 @@ title: Flutter -caseStyle: camelCase +caseStyle: canonical supportLevel: production +sdk: sentry.dart.flutter +fallbackPlatform: dart From 9fecdd6737297812b28d2520db7c2236dc0daa5b Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 14:29:15 +0100 Subject: [PATCH 31/55] add index --- src/platforms/dart/index.mdx | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/platforms/dart/index.mdx diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx new file mode 100644 index 0000000000000..950cffe22fe66 --- /dev/null +++ b/src/platforms/dart/index.mdx @@ -0,0 +1,61 @@ +--- +title: Dart +--- + +Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: + + + +Import `Sentry` and initialize it: + + + +Run the whole app in a zone to capture all uncaught errors: + +```dart +import 'dart:async'; +import 'package:flutter/widgets.dart'; +import 'package:sentry/sentry.dart'; + +// Wrap your 'runApp(MyApp())' as follows: + +void main() { + runZonedGuarded(() { + runApp(MyApp()); + }, (exception, stackTrace) async { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); + }); +} +``` + +Catch Flutter specific errors by subscribing to `FlutterError.onError`: + +```dart +import 'package:flutter/foundation.dart'; +import 'package:sentry/sentry.dart'; + +void main() { + FlutterError.onError = (FlutterErrorDetails details) async { + await Sentry.captureException( + details.exception, + stackTrace: details.stack, + ); + }; +} +``` + +Capture a test exception: + + + +### Resources + +Flutter has extensive documentation, including a +[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). + +### Source code + +The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). From e7b02033d41479e1ac708ac0de899e20b1110d67 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 15:05:30 +0100 Subject: [PATCH 32/55] rename files --- src/includes/before-breadcrumb/{flutter.mdx => dart.mdx} | 0 src/includes/breadcrumbs-example/{flutter.mdx => dart.mdx} | 0 src/includes/capture-error/{flutter.mdx => dart.mdx} | 0 src/includes/capture-message/{flutter.mdx => dart.mdx} | 0 .../before-breadcrumb-hint/{flutter.mdx => dart.mdx} | 0 .../before-send-fingerprint/{flutter.mdx => dart.mdx} | 0 .../configuration/before-send-hint/{flutter.mdx => dart.mdx} | 0 src/includes/configuration/before-send/{flutter.mdx => dart.mdx} | 0 src/includes/configuration/config-intro/{flutter.mdx => dart.mdx} | 0 src/includes/configuration/sample-rate/{flutter.mdx => dart.mdx} | 0 src/includes/configure-scope/{flutter.mdx => dart.mdx} | 0 src/includes/getting-started-config/{flutter.mdx => dart.mdx} | 0 src/includes/getting-started-install/{flutter.mdx => dart.mdx} | 0 src/includes/getting-started-verify/{flutter.mdx => dart.mdx} | 0 src/includes/sensitive-data/set-tag/{flutter.mdx => dart.mdx} | 0 src/includes/sensitive-data/set-user/{flutter.mdx => dart.mdx} | 0 src/includes/set-context/{flutter.mdx => dart.mdx} | 0 src/includes/set-environment/{flutter.mdx => dart.mdx} | 0 src/includes/set-extra/{flutter.mdx => dart.mdx} | 0 src/includes/set-fingerprint/basic/{flutter.mdx => dart.mdx} | 0 .../set-fingerprint/database-connection/{flutter.mdx => dart.mdx} | 0 src/includes/set-fingerprint/rpc/{flutter.mdx => dart.mdx} | 0 src/includes/set-fingerprint/static/{flutter.mdx => dart.mdx} | 0 src/includes/set-level/{flutter.mdx => dart.mdx} | 0 src/includes/set-release/{flutter.mdx => dart.mdx} | 0 src/includes/set-tag/{flutter.mdx => dart.mdx} | 0 src/includes/set-user/{flutter.mdx => dart.mdx} | 0 src/includes/unset-user/{flutter.mdx => dart.mdx} | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename src/includes/before-breadcrumb/{flutter.mdx => dart.mdx} (100%) rename src/includes/breadcrumbs-example/{flutter.mdx => dart.mdx} (100%) rename src/includes/capture-error/{flutter.mdx => dart.mdx} (100%) rename src/includes/capture-message/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/before-breadcrumb-hint/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/before-send-fingerprint/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/before-send-hint/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/before-send/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/config-intro/{flutter.mdx => dart.mdx} (100%) rename src/includes/configuration/sample-rate/{flutter.mdx => dart.mdx} (100%) rename src/includes/configure-scope/{flutter.mdx => dart.mdx} (100%) rename src/includes/getting-started-config/{flutter.mdx => dart.mdx} (100%) rename src/includes/getting-started-install/{flutter.mdx => dart.mdx} (100%) rename src/includes/getting-started-verify/{flutter.mdx => dart.mdx} (100%) rename src/includes/sensitive-data/set-tag/{flutter.mdx => dart.mdx} (100%) rename src/includes/sensitive-data/set-user/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-context/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-environment/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-extra/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-fingerprint/basic/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-fingerprint/database-connection/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-fingerprint/rpc/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-fingerprint/static/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-level/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-release/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-tag/{flutter.mdx => dart.mdx} (100%) rename src/includes/set-user/{flutter.mdx => dart.mdx} (100%) rename src/includes/unset-user/{flutter.mdx => dart.mdx} (100%) diff --git a/src/includes/before-breadcrumb/flutter.mdx b/src/includes/before-breadcrumb/dart.mdx similarity index 100% rename from src/includes/before-breadcrumb/flutter.mdx rename to src/includes/before-breadcrumb/dart.mdx diff --git a/src/includes/breadcrumbs-example/flutter.mdx b/src/includes/breadcrumbs-example/dart.mdx similarity index 100% rename from src/includes/breadcrumbs-example/flutter.mdx rename to src/includes/breadcrumbs-example/dart.mdx diff --git a/src/includes/capture-error/flutter.mdx b/src/includes/capture-error/dart.mdx similarity index 100% rename from src/includes/capture-error/flutter.mdx rename to src/includes/capture-error/dart.mdx diff --git a/src/includes/capture-message/flutter.mdx b/src/includes/capture-message/dart.mdx similarity index 100% rename from src/includes/capture-message/flutter.mdx rename to src/includes/capture-message/dart.mdx diff --git a/src/includes/configuration/before-breadcrumb-hint/flutter.mdx b/src/includes/configuration/before-breadcrumb-hint/dart.mdx similarity index 100% rename from src/includes/configuration/before-breadcrumb-hint/flutter.mdx rename to src/includes/configuration/before-breadcrumb-hint/dart.mdx diff --git a/src/includes/configuration/before-send-fingerprint/flutter.mdx b/src/includes/configuration/before-send-fingerprint/dart.mdx similarity index 100% rename from src/includes/configuration/before-send-fingerprint/flutter.mdx rename to src/includes/configuration/before-send-fingerprint/dart.mdx diff --git a/src/includes/configuration/before-send-hint/flutter.mdx b/src/includes/configuration/before-send-hint/dart.mdx similarity index 100% rename from src/includes/configuration/before-send-hint/flutter.mdx rename to src/includes/configuration/before-send-hint/dart.mdx diff --git a/src/includes/configuration/before-send/flutter.mdx b/src/includes/configuration/before-send/dart.mdx similarity index 100% rename from src/includes/configuration/before-send/flutter.mdx rename to src/includes/configuration/before-send/dart.mdx diff --git a/src/includes/configuration/config-intro/flutter.mdx b/src/includes/configuration/config-intro/dart.mdx similarity index 100% rename from src/includes/configuration/config-intro/flutter.mdx rename to src/includes/configuration/config-intro/dart.mdx diff --git a/src/includes/configuration/sample-rate/flutter.mdx b/src/includes/configuration/sample-rate/dart.mdx similarity index 100% rename from src/includes/configuration/sample-rate/flutter.mdx rename to src/includes/configuration/sample-rate/dart.mdx diff --git a/src/includes/configure-scope/flutter.mdx b/src/includes/configure-scope/dart.mdx similarity index 100% rename from src/includes/configure-scope/flutter.mdx rename to src/includes/configure-scope/dart.mdx diff --git a/src/includes/getting-started-config/flutter.mdx b/src/includes/getting-started-config/dart.mdx similarity index 100% rename from src/includes/getting-started-config/flutter.mdx rename to src/includes/getting-started-config/dart.mdx diff --git a/src/includes/getting-started-install/flutter.mdx b/src/includes/getting-started-install/dart.mdx similarity index 100% rename from src/includes/getting-started-install/flutter.mdx rename to src/includes/getting-started-install/dart.mdx diff --git a/src/includes/getting-started-verify/flutter.mdx b/src/includes/getting-started-verify/dart.mdx similarity index 100% rename from src/includes/getting-started-verify/flutter.mdx rename to src/includes/getting-started-verify/dart.mdx diff --git a/src/includes/sensitive-data/set-tag/flutter.mdx b/src/includes/sensitive-data/set-tag/dart.mdx similarity index 100% rename from src/includes/sensitive-data/set-tag/flutter.mdx rename to src/includes/sensitive-data/set-tag/dart.mdx diff --git a/src/includes/sensitive-data/set-user/flutter.mdx b/src/includes/sensitive-data/set-user/dart.mdx similarity index 100% rename from src/includes/sensitive-data/set-user/flutter.mdx rename to src/includes/sensitive-data/set-user/dart.mdx diff --git a/src/includes/set-context/flutter.mdx b/src/includes/set-context/dart.mdx similarity index 100% rename from src/includes/set-context/flutter.mdx rename to src/includes/set-context/dart.mdx diff --git a/src/includes/set-environment/flutter.mdx b/src/includes/set-environment/dart.mdx similarity index 100% rename from src/includes/set-environment/flutter.mdx rename to src/includes/set-environment/dart.mdx diff --git a/src/includes/set-extra/flutter.mdx b/src/includes/set-extra/dart.mdx similarity index 100% rename from src/includes/set-extra/flutter.mdx rename to src/includes/set-extra/dart.mdx diff --git a/src/includes/set-fingerprint/basic/flutter.mdx b/src/includes/set-fingerprint/basic/dart.mdx similarity index 100% rename from src/includes/set-fingerprint/basic/flutter.mdx rename to src/includes/set-fingerprint/basic/dart.mdx diff --git a/src/includes/set-fingerprint/database-connection/flutter.mdx b/src/includes/set-fingerprint/database-connection/dart.mdx similarity index 100% rename from src/includes/set-fingerprint/database-connection/flutter.mdx rename to src/includes/set-fingerprint/database-connection/dart.mdx diff --git a/src/includes/set-fingerprint/rpc/flutter.mdx b/src/includes/set-fingerprint/rpc/dart.mdx similarity index 100% rename from src/includes/set-fingerprint/rpc/flutter.mdx rename to src/includes/set-fingerprint/rpc/dart.mdx diff --git a/src/includes/set-fingerprint/static/flutter.mdx b/src/includes/set-fingerprint/static/dart.mdx similarity index 100% rename from src/includes/set-fingerprint/static/flutter.mdx rename to src/includes/set-fingerprint/static/dart.mdx diff --git a/src/includes/set-level/flutter.mdx b/src/includes/set-level/dart.mdx similarity index 100% rename from src/includes/set-level/flutter.mdx rename to src/includes/set-level/dart.mdx diff --git a/src/includes/set-release/flutter.mdx b/src/includes/set-release/dart.mdx similarity index 100% rename from src/includes/set-release/flutter.mdx rename to src/includes/set-release/dart.mdx diff --git a/src/includes/set-tag/flutter.mdx b/src/includes/set-tag/dart.mdx similarity index 100% rename from src/includes/set-tag/flutter.mdx rename to src/includes/set-tag/dart.mdx diff --git a/src/includes/set-user/flutter.mdx b/src/includes/set-user/dart.mdx similarity index 100% rename from src/includes/set-user/flutter.mdx rename to src/includes/set-user/dart.mdx diff --git a/src/includes/unset-user/flutter.mdx b/src/includes/unset-user/dart.mdx similarity index 100% rename from src/includes/unset-user/flutter.mdx rename to src/includes/unset-user/dart.mdx From 3585c1ad524b99736eddb440e5f0deab1430f5c3 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 17:37:29 +0100 Subject: [PATCH 33/55] ref --- src/includes/before-breadcrumb/dart.mdx | 6 ++- src/includes/breadcrumbs-example/dart.mdx | 18 ++------- src/includes/capture-error/dart.mdx | 19 ++++----- src/includes/capture-message/dart.mdx | 4 +- src/includes/configure-scope/dart.mdx | 10 ++--- src/includes/getting-started-config/dart.mdx | 6 ++- src/includes/getting-started-verify/dart.mdx | 19 +++++---- src/includes/sensitive-data/set-tag/dart.mdx | 4 +- src/includes/sensitive-data/set-user/dart.mdx | 4 +- src/includes/set-context/dart.mdx | 16 ++++---- src/includes/set-environment/dart.mdx | 4 +- src/includes/set-extra/dart.mdx | 4 +- src/includes/set-fingerprint/basic/dart.mdx | 14 ++++--- .../database-connection/dart.mdx | 14 ++++--- src/includes/set-fingerprint/rpc/dart.mdx | 34 ++++++++-------- src/includes/set-fingerprint/static/dart.mdx | 4 +- src/includes/set-level/dart.mdx | 4 +- src/includes/set-release/dart.mdx | 6 ++- src/includes/set-tag/dart.mdx | 4 +- src/includes/set-user/dart.mdx | 4 +- src/includes/unset-user/dart.mdx | 4 +- src/platforms/dart/index.mdx | 39 +------------------ src/platforms/flutter/config.yml | 3 ++ src/platforms/flutter/index.mdx | 39 +------------------ 24 files changed, 118 insertions(+), 165 deletions(-) diff --git a/src/includes/before-breadcrumb/dart.mdx b/src/includes/before-breadcrumb/dart.mdx index 4ba36250c7479..2cad76513cb6a 100644 --- a/src/includes/before-breadcrumb/dart.mdx +++ b/src/includes/before-breadcrumb/dart.mdx @@ -1,9 +1,11 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() async { Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { return 'a.spammy.Logger' == crumb.category ? null : crumb; } - Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); + await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); +} ``` diff --git a/src/includes/breadcrumbs-example/dart.mdx b/src/includes/breadcrumbs-example/dart.mdx index c1ea995c06be0..46d2c1e0fabbf 100644 --- a/src/includes/breadcrumbs-example/dart.mdx +++ b/src/includes/breadcrumbs-example/dart.mdx @@ -1,19 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; - - void scope(Scope scope) { - final crumb = Breadcrumb( - message: 'Authenticated user ${scope.user.email}', - category: 'auth', - level: SentryLevel.info, - ); - - scope.addBreadcrumb(crumb); - } - - Sentry.configureScope(scope); - - // or +import 'package:sentry/sentry.dart'; +void main() async { Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); +} ``` diff --git a/src/includes/capture-error/dart.mdx b/src/includes/capture-error/dart.mdx index 718e56d8f5a55..5a9cee227d1aa 100644 --- a/src/includes/capture-error/dart.mdx +++ b/src/includes/capture-error/dart.mdx @@ -1,19 +1,20 @@ In Dart you can capture any exception object that you caught: ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() async { try { aMethodThatMightFail(); } catch (exception, stackTrace) { - await Sentry.captureException(exception, stackTrace: stackTrace); + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); } +} - // or - - try { - throw 'Not implemented'; - } catch (exception, stackTrace) { - await Sentry.captureException(exception, stackTrace: stackTrace); - } +void aMethodThatMightFail() { + throw null; +} ``` diff --git a/src/includes/capture-message/dart.mdx b/src/includes/capture-message/dart.mdx index e95a20ba42af1..0d3b6d081d64a 100644 --- a/src/includes/capture-message/dart.mdx +++ b/src/includes/capture-message/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() async { await Sentry.captureMessage('Something went wrong'); +} ``` diff --git a/src/includes/configure-scope/dart.mdx b/src/includes/configure-scope/dart.mdx index 91ee1ea51245f..3826bdfbe92a3 100644 --- a/src/includes/configure-scope/dart.mdx +++ b/src/includes/configure-scope/dart.mdx @@ -1,11 +1,11 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - void scope(Scope scope) { +void main() { + Sentry.configureScope((scope) { scope.setTag('my-tag', 'my value'); final user = User(id: '42', email: 'john.doe@example.com'); scope.user = user; - } - - Sentry.configureScope(scope); + }); +} ``` diff --git a/src/includes/getting-started-config/dart.mdx b/src/includes/getting-started-config/dart.mdx index 3819dfd688f18..e8e713df3822d 100644 --- a/src/includes/getting-started-config/dart.mdx +++ b/src/includes/getting-started-config/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); +Future main() async { + await Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); +} ``` diff --git a/src/includes/getting-started-verify/dart.mdx b/src/includes/getting-started-verify/dart.mdx index c4be6f6d8d20f..9d8f4d9871656 100644 --- a/src/includes/getting-started-verify/dart.mdx +++ b/src/includes/getting-started-verify/dart.mdx @@ -1,11 +1,14 @@ ```dart -// Throw an exception and capture it with the Sentry client: -try { - throw null; -} catch (exception, stackTrace) { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); +import 'package:sentry/sentry.dart'; + +Future main() async { + try { + throw null; + } catch (exception, stackTrace) { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); + } } ``` diff --git a/src/includes/sensitive-data/set-tag/dart.mdx b/src/includes/sensitive-data/set-tag/dart.mdx index 63e747c55c947..bc2d1ab4661ac 100644 --- a/src/includes/sensitive-data/set-tag/dart.mdx +++ b/src/includes/sensitive-data/set-tag/dart.mdx @@ -1,8 +1,10 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.setTag( 'birthday', checksumOrHash('08/12/1990'), )); +} ``` diff --git a/src/includes/sensitive-data/set-user/dart.mdx b/src/includes/sensitive-data/set-user/dart.mdx index 4606a443263f0..f5569b8226f03 100644 --- a/src/includes/sensitive-data/set-user/dart.mdx +++ b/src/includes/sensitive-data/set-user/dart.mdx @@ -1,8 +1,10 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.user = User( id: clientUser.id, username: clientUser.username, )); +} ``` diff --git a/src/includes/set-context/dart.mdx b/src/includes/set-context/dart.mdx index 778f9699cb3f0..13ed861e90617 100644 --- a/src/includes/set-context/dart.mdx +++ b/src/includes/set-context/dart.mdx @@ -1,11 +1,11 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - void scope(Scope scope) { - scope.setExtra('name', 'Mighty Fighter'); - scope.setExtra('age', 19); - scope.setExtra('attack_type', 'melee'); - } - - Sentry.configureScope(scope); +void main() { + final person = { + 'name': 'Mighty Fighter', + 'age': '19', + }; + Sentry.configureScope((scope) => scope.setContexts('person', person)); +} ``` diff --git a/src/includes/set-environment/dart.mdx b/src/includes/set-environment/dart.mdx index 38140c63fbe9b..b691574063c6d 100644 --- a/src/includes/set-environment/dart.mdx +++ b/src/includes/set-environment/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.init((options) => options.environment = 'staging'); +} ``` diff --git a/src/includes/set-extra/dart.mdx b/src/includes/set-extra/dart.mdx index a92261972cbe8..929c8557e2719 100644 --- a/src/includes/set-extra/dart.mdx +++ b/src/includes/set-extra/dart.mdx @@ -1,8 +1,10 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.setExtra( 'character.name', 'Mighty Fighter', )); +} ``` diff --git a/src/includes/set-fingerprint/basic/dart.mdx b/src/includes/set-fingerprint/basic/dart.mdx index a823e4114ca31..7bf5be47ca0cf 100644 --- a/src/includes/set-fingerprint/basic/dart.mdx +++ b/src/includes/set-fingerprint/basic/dart.mdx @@ -1,12 +1,14 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - if (event.exception is DatabaseException) { - event = event.copyWith(fingerprint: ['database-connection-error']); - } - return event; +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); } + return event; +} +void main() { Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/set-fingerprint/database-connection/dart.mdx b/src/includes/set-fingerprint/database-connection/dart.mdx index a823e4114ca31..7bf5be47ca0cf 100644 --- a/src/includes/set-fingerprint/database-connection/dart.mdx +++ b/src/includes/set-fingerprint/database-connection/dart.mdx @@ -1,12 +1,14 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - if (event.exception is DatabaseException) { - event = event.copyWith(fingerprint: ['database-connection-error']); - } - return event; +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); } + return event; +} +void main() { Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/set-fingerprint/rpc/dart.mdx b/src/includes/set-fingerprint/rpc/dart.mdx index 9f07f39cffed0..27e07dcd56742 100644 --- a/src/includes/set-fingerprint/rpc/dart.mdx +++ b/src/includes/set-fingerprint/rpc/dart.mdx @@ -1,24 +1,26 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - class MyRpcException implements Exception { - final String function; - final int httpStatusCode; +class MyRpcException implements Exception { + final String function; + final int httpStatusCode; - MyRpcException(this.function, this.httpStatusCode); - } + MyRpcException(this.function, this.httpStatusCode); +} - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - if (event.exception is MyRpcException) { - final exception = event.exception as MyRpcException; - event = event.copyWith(fingerprint: [ - '{{ default }}', - exception.function, - exception.httpStatusCode.toString(), - ]); - } - return event; +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is MyRpcException) { + final exception = event.exception as MyRpcException; + event = event.copyWith(fingerprint: [ + '{{ default }}', + exception.function, + exception.httpStatusCode.toString(), + ]); } + return event; +} +void main() { Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/set-fingerprint/static/dart.mdx b/src/includes/set-fingerprint/static/dart.mdx index dd0492e116e9e..0668b91ea68de 100644 --- a/src/includes/set-fingerprint/static/dart.mdx +++ b/src/includes/set-fingerprint/static/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']); +} ``` diff --git a/src/includes/set-level/dart.mdx b/src/includes/set-level/dart.mdx index 9e23e9c6ee368..733a955c82cfa 100644 --- a/src/includes/set-level/dart.mdx +++ b/src/includes/set-level/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.level = SentryLevel.warning); +} ``` diff --git a/src/includes/set-release/dart.mdx b/src/includes/set-release/dart.mdx index 2779cf09f2176..bc8ff701528d6 100644 --- a/src/includes/set-release/dart.mdx +++ b/src/includes/set-release/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - Sentry.init((options) => options.release = 'my-project-name@2.3.12'); +void main() { + Sentry.init((options) => options.release = 'my-project-name@2.3.12+12'); +} ``` diff --git a/src/includes/set-tag/dart.mdx b/src/includes/set-tag/dart.mdx index 651ee9aa6195a..38e18c951669d 100644 --- a/src/includes/set-tag/dart.mdx +++ b/src/includes/set-tag/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.setTag('page.locale', 'pt-BR')); +} ``` diff --git a/src/includes/set-user/dart.mdx b/src/includes/set-user/dart.mdx index f8671ea4ff357..35295f9785c73 100644 --- a/src/includes/set-user/dart.mdx +++ b/src/includes/set-user/dart.mdx @@ -1,7 +1,9 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope( (scope) => scope.user = User(email: 'jane.doe@example.com'), ); +} ``` diff --git a/src/includes/unset-user/dart.mdx b/src/includes/unset-user/dart.mdx index b39ebb39a71fc..b17e2790a48fc 100644 --- a/src/includes/unset-user/dart.mdx +++ b/src/includes/unset-user/dart.mdx @@ -1,5 +1,7 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() { Sentry.configureScope((scope) => scope.user = null); +} ``` diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index 950cffe22fe66..3b17aef7fd781 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -2,7 +2,7 @@ title: Dart --- -Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: +Get the SDK from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: @@ -10,43 +10,6 @@ Import `Sentry` and initialize it: -Run the whole app in a zone to capture all uncaught errors: - -```dart -import 'dart:async'; -import 'package:flutter/widgets.dart'; -import 'package:sentry/sentry.dart'; - -// Wrap your 'runApp(MyApp())' as follows: - -void main() { - runZonedGuarded(() { - runApp(MyApp()); - }, (exception, stackTrace) async { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); - }); -} -``` - -Catch Flutter specific errors by subscribing to `FlutterError.onError`: - -```dart -import 'package:flutter/foundation.dart'; -import 'package:sentry/sentry.dart'; - -void main() { - FlutterError.onError = (FlutterErrorDetails details) async { - await Sentry.captureException( - details.exception, - stackTrace: details.stack, - ); - }; -} -``` - Capture a test exception: diff --git a/src/platforms/flutter/config.yml b/src/platforms/flutter/config.yml index a357696967f04..7fe956d29c000 100644 --- a/src/platforms/flutter/config.yml +++ b/src/platforms/flutter/config.yml @@ -3,3 +3,6 @@ caseStyle: canonical supportLevel: production sdk: sentry.dart.flutter fallbackPlatform: dart +categories: + - mobile + - browser diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 3829004ce22db..b1e67619aff45 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -2,7 +2,7 @@ title: Flutter --- -Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: +Get the SDK from [pub.dev](https://pub.dev/packages/sentry_flutter) by adding the following to your `pubspec.yaml`: @@ -10,43 +10,6 @@ Import `Sentry` and initialize it: -Run the whole app in a zone to capture all uncaught errors: - -```dart -import 'dart:async'; -import 'package:flutter/widgets.dart'; -import 'package:sentry/sentry.dart'; - -// Wrap your 'runApp(MyApp())' as follows: - -void main() { - runZonedGuarded(() { - runApp(MyApp()); - }, (exception, stackTrace) async { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); - }); -} -``` - -Catch Flutter specific errors by subscribing to `FlutterError.onError`: - -```dart -import 'package:flutter/foundation.dart'; -import 'package:sentry/sentry.dart'; - -void main() { - FlutterError.onError = (FlutterErrorDetails details) async { - await Sentry.captureException( - details.exception, - stackTrace: details.stack, - ); - }; -} -``` - Capture a test exception: From be43f2542c212faadf92c1f48d15e9495791f7b7 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 20:12:22 +0100 Subject: [PATCH 34/55] no need of future main methods --- src/includes/breadcrumbs-example/dart.mdx | 2 +- src/includes/getting-started-config/dart.mdx | 2 +- src/includes/getting-started-verify/dart.mdx | 2 +- src/includes/set-fingerprint/rpc/dart.mdx | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/includes/breadcrumbs-example/dart.mdx b/src/includes/breadcrumbs-example/dart.mdx index 46d2c1e0fabbf..6103a63d33996 100644 --- a/src/includes/breadcrumbs-example/dart.mdx +++ b/src/includes/breadcrumbs-example/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +void main() { Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); } ``` diff --git a/src/includes/getting-started-config/dart.mdx b/src/includes/getting-started-config/dart.mdx index e8e713df3822d..bc296ef1e206b 100644 --- a/src/includes/getting-started-config/dart.mdx +++ b/src/includes/getting-started-config/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() async { +void main() async { await Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); } ``` diff --git a/src/includes/getting-started-verify/dart.mdx b/src/includes/getting-started-verify/dart.mdx index 9d8f4d9871656..30cbd8c8b19dd 100644 --- a/src/includes/getting-started-verify/dart.mdx +++ b/src/includes/getting-started-verify/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() async { +void main() async { try { throw null; } catch (exception, stackTrace) { diff --git a/src/includes/set-fingerprint/rpc/dart.mdx b/src/includes/set-fingerprint/rpc/dart.mdx index 27e07dcd56742..b6835ea920393 100644 --- a/src/includes/set-fingerprint/rpc/dart.mdx +++ b/src/includes/set-fingerprint/rpc/dart.mdx @@ -20,7 +20,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() { - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); } ``` From 8048aec4df7dbe0b8671f3ee7a86df59ef0e658e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 20:38:19 +0100 Subject: [PATCH 35/55] fix dart files --- src/includes/before-breadcrumb/dart.mdx | 10 +++++----- src/includes/capture-error/dart.mdx | 4 ---- .../before-breadcrumb-hint/dart.mdx | 12 +++++++----- .../before-send-fingerprint/dart.mdx | 16 +++++++++------- .../configuration/before-send-hint/dart.mdx | 12 +++++++----- src/includes/configuration/before-send/dart.mdx | 16 +++++++++------- src/includes/configuration/config-intro/dart.mdx | 13 +++++++------ src/includes/configuration/sample-rate/dart.mdx | 6 ++++-- src/includes/configure-scope/dart.mdx | 10 ++++------ src/includes/getting-started-verify/dart.mdx | 2 +- src/includes/set-environment/dart.mdx | 4 ++-- src/includes/set-fingerprint/basic/dart.mdx | 4 ++-- .../set-fingerprint/database-connection/dart.mdx | 4 ++-- src/includes/set-release/dart.mdx | 4 ++-- 14 files changed, 61 insertions(+), 56 deletions(-) diff --git a/src/includes/before-breadcrumb/dart.mdx b/src/includes/before-breadcrumb/dart.mdx index 2cad76513cb6a..520beb0b089d9 100644 --- a/src/includes/before-breadcrumb/dart.mdx +++ b/src/includes/before-breadcrumb/dart.mdx @@ -1,11 +1,11 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { - Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { - return 'a.spammy.Logger' == crumb.category ? null : crumb; - } +Breadcrumb beforeBreadcrumb(Breadcrumb breadcrumb, dynamic hint) { + return 'a.spammy.Logger' == breadcrumb.category ? null : breadcrumb; +} - await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); +void main() async { + await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb); } ``` diff --git a/src/includes/capture-error/dart.mdx b/src/includes/capture-error/dart.mdx index 5a9cee227d1aa..80e3432237676 100644 --- a/src/includes/capture-error/dart.mdx +++ b/src/includes/capture-error/dart.mdx @@ -13,8 +13,4 @@ void main() async { ); } } - -void aMethodThatMightFail() { - throw null; -} ``` diff --git a/src/includes/configuration/before-breadcrumb-hint/dart.mdx b/src/includes/configuration/before-breadcrumb-hint/dart.mdx index 2216c11f36453..d764ab89822cc 100644 --- a/src/includes/configuration/before-breadcrumb-hint/dart.mdx +++ b/src/includes/configuration/before-breadcrumb-hint/dart.mdx @@ -1,9 +1,11 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - Breadcrumb beforeBreadCrumb(Breadcrumb crumb, dynamic hint) { - return hint is MyHint ? null : crumb; - } +Breadcrumb beforeBreadcrumb(Breadcrumb crumb, dynamic hint) { + return hint is MyHint ? null : crumb; +} - Sentry.init((options) => options.beforeBreadcrumb = beforeBreadCrumb); +void main() async { + await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb); +} ``` diff --git a/src/includes/configuration/before-send-fingerprint/dart.mdx b/src/includes/configuration/before-send-fingerprint/dart.mdx index a823e4114ca31..051961a81fddf 100644 --- a/src/includes/configuration/before-send-fingerprint/dart.mdx +++ b/src/includes/configuration/before-send-fingerprint/dart.mdx @@ -1,12 +1,14 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - if (event.exception is DatabaseException) { - event = event.copyWith(fingerprint: ['database-connection-error']); - } - return event; +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + if (event.exception is DatabaseException) { + event = event.copyWith(fingerprint: ['database-connection-error']); } + return event; +} - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/configuration/before-send-hint/dart.mdx b/src/includes/configuration/before-send-hint/dart.mdx index 59f22ea7ca787..d2d0b3d0a6f11 100644 --- a/src/includes/configuration/before-send-hint/dart.mdx +++ b/src/includes/configuration/before-send-hint/dart.mdx @@ -1,11 +1,13 @@ A `BiFunction` can be used to mutate, discard (return null), or return a completely new event. ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - return hint is MyHint ? null : event; - } +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + return hint is MyHint ? null : event; +} - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/configuration/before-send/dart.mdx b/src/includes/configuration/before-send/dart.mdx index a487c968f85f9..d806e1ea5e48d 100644 --- a/src/includes/configuration/before-send/dart.mdx +++ b/src/includes/configuration/before-send/dart.mdx @@ -1,13 +1,15 @@ A `BiFunction` can be used to mutate, discard (return null), or return a completely new event. ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; - SentryEvent beforeSend(SentryEvent event, dynamic hint) { - // Modify the event here: - event = event.copyWith(serverName: null); // Don't send server names. - return event; - } +SentryEvent beforeSend(SentryEvent event, dynamic hint) { + // Modify the event here: + event = event.copyWith(serverName: null); // Don't send server names. + return event; +} - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); +} ``` diff --git a/src/includes/configuration/config-intro/dart.mdx b/src/includes/configuration/config-intro/dart.mdx index f75137a7287a3..0eb21bfc6a2e5 100644 --- a/src/includes/configuration/config-intro/dart.mdx +++ b/src/includes/configuration/config-intro/dart.mdx @@ -1,11 +1,12 @@ Options are passed to the `Sentry.init` method: ```dart - void options(SentryOptions options) { - options.dsn = '___PUBLIC_DSN___'; - options.release = 'my-project-name@2.3.12'; - options.environment = 'staging'; - } +import 'package:sentry/sentry.dart'; - Sentry.init(options); +void main() async { + await Sentry.init((options) => options + ..dsn = '___PUBLIC_DSN___' + ..release = 'my-project-name@2.3.12' + ..environment = 'staging'); +} ``` diff --git a/src/includes/configuration/sample-rate/dart.mdx b/src/includes/configuration/sample-rate/dart.mdx index 7029f9dca9535..13a54726c80aa 100644 --- a/src/includes/configuration/sample-rate/dart.mdx +++ b/src/includes/configuration/sample-rate/dart.mdx @@ -1,6 +1,8 @@ ```dart - import 'package:sentry/sentry.dart'; +import 'package:sentry/sentry.dart'; +void main() async { // Capture only 25% of events - Sentry.init((options) => options.sampleRate = 0.25); + await Sentry.init((options) => options.sampleRate = 0.25); +} ``` diff --git a/src/includes/configure-scope/dart.mdx b/src/includes/configure-scope/dart.mdx index 3826bdfbe92a3..c4a28f87ba47e 100644 --- a/src/includes/configure-scope/dart.mdx +++ b/src/includes/configure-scope/dart.mdx @@ -1,11 +1,9 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) { - scope.setTag('my-tag', 'my value'); - final user = User(id: '42', email: 'john.doe@example.com'); - scope.user = user; - }); +void main() async { + Sentry.configureScope((scope) => scope + ..setTag('my-tag', 'my value') + ..user = User(id: '42', email: 'john.doe@example.com')); } ``` diff --git a/src/includes/getting-started-verify/dart.mdx b/src/includes/getting-started-verify/dart.mdx index 30cbd8c8b19dd..66ecf1cc0b5d8 100644 --- a/src/includes/getting-started-verify/dart.mdx +++ b/src/includes/getting-started-verify/dart.mdx @@ -3,7 +3,7 @@ import 'package:sentry/sentry.dart'; void main() async { try { - throw null; + aMethodThatMightFail(); } catch (exception, stackTrace) { await Sentry.captureException( exception, diff --git a/src/includes/set-environment/dart.mdx b/src/includes/set-environment/dart.mdx index b691574063c6d..c5e8373a431b0 100644 --- a/src/includes/set-environment/dart.mdx +++ b/src/includes/set-environment/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.init((options) => options.environment = 'staging'); +void main() async { + await Sentry.init((options) => options.environment = 'staging'); } ``` diff --git a/src/includes/set-fingerprint/basic/dart.mdx b/src/includes/set-fingerprint/basic/dart.mdx index 7bf5be47ca0cf..051961a81fddf 100644 --- a/src/includes/set-fingerprint/basic/dart.mdx +++ b/src/includes/set-fingerprint/basic/dart.mdx @@ -8,7 +8,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() { - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/set-fingerprint/database-connection/dart.mdx b/src/includes/set-fingerprint/database-connection/dart.mdx index 7bf5be47ca0cf..051961a81fddf 100644 --- a/src/includes/set-fingerprint/database-connection/dart.mdx +++ b/src/includes/set-fingerprint/database-connection/dart.mdx @@ -8,7 +8,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() { - Sentry.init((options) => options.beforeSend = beforeSend); +void main() async { + await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/set-release/dart.mdx b/src/includes/set-release/dart.mdx index bc8ff701528d6..5fd63edd3b1db 100644 --- a/src/includes/set-release/dart.mdx +++ b/src/includes/set-release/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.init((options) => options.release = 'my-project-name@2.3.12+12'); +void main() async { + await Sentry.init((options) => options.release = 'my-project-name@2.3.12+12'); } ``` From 5315d67c3ba2e05206dccd4fc652325dd6802282 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 21:31:11 +0100 Subject: [PATCH 36/55] add specific Flutter files --- .../auto-session-tracking/flutter.mdx | 14 ++++++++++++++ .../configuration/config-intro/flutter.mdx | 19 +++++++++++++++++++ .../session-tracking-interval/flutter.mdx | 14 ++++++++++++++ .../getting-started-config/flutter.mdx | 16 ++++++++++++++++ .../getting-started-install/flutter.mdx | 4 ++++ src/includes/set-environment/flutter.mdx | 17 +++++++++++++++++ src/includes/set-release/flutter.mdx | 17 +++++++++++++++++ 7 files changed, 101 insertions(+) create mode 100644 src/includes/configuration/auto-session-tracking/flutter.mdx create mode 100644 src/includes/configuration/config-intro/flutter.mdx create mode 100644 src/includes/configuration/session-tracking-interval/flutter.mdx create mode 100644 src/includes/getting-started-config/flutter.mdx create mode 100644 src/includes/getting-started-install/flutter.mdx create mode 100644 src/includes/set-environment/flutter.mdx create mode 100644 src/includes/set-release/flutter.mdx diff --git a/src/includes/configuration/auto-session-tracking/flutter.mdx b/src/includes/configuration/auto-session-tracking/flutter.mdx new file mode 100644 index 0000000000000..8981b5273ddac --- /dev/null +++ b/src/includes/configuration/auto-session-tracking/flutter.mdx @@ -0,0 +1,14 @@ +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options.enableAutoSessionTracking = true, + () { + // Run your App + runApp(MyApp()); + }, + ); +} +``` diff --git a/src/includes/configuration/config-intro/flutter.mdx b/src/includes/configuration/config-intro/flutter.mdx new file mode 100644 index 0000000000000..ade9c0c26b968 --- /dev/null +++ b/src/includes/configuration/config-intro/flutter.mdx @@ -0,0 +1,19 @@ +Options are passed to the `SentryFlutter.init` method: + +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options + ..dsn = '___PUBLIC_DSN___' + ..release = 'my-project-name@2.3.12' + ..environment = 'staging', + () { + // Run your App + runApp(MyApp()); + }, + ); +} +``` diff --git a/src/includes/configuration/session-tracking-interval/flutter.mdx b/src/includes/configuration/session-tracking-interval/flutter.mdx new file mode 100644 index 0000000000000..518b29677f952 --- /dev/null +++ b/src/includes/configuration/session-tracking-interval/flutter.mdx @@ -0,0 +1,14 @@ +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options.autoSessionTrackingIntervalMillis = 10000, + () { + // Run your App + runApp(MyApp()); + }, + ); +} +``` diff --git a/src/includes/getting-started-config/flutter.mdx b/src/includes/getting-started-config/flutter.mdx new file mode 100644 index 0000000000000..89a3cc9682ec1 --- /dev/null +++ b/src/includes/getting-started-config/flutter.mdx @@ -0,0 +1,16 @@ +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options.dsn = '___PUBLIC_DSN___', + () { + // Run your App + runApp(MyApp()); + }, + ); + + // or define SENTRY_DSN via Dart environment variable (--dart-define) +} +``` diff --git a/src/includes/getting-started-install/flutter.mdx b/src/includes/getting-started-install/flutter.mdx new file mode 100644 index 0000000000000..157cd904a88d9 --- /dev/null +++ b/src/includes/getting-started-install/flutter.mdx @@ -0,0 +1,4 @@ +```yml {filename:pubspec.yaml} +dependencies: + sentry_flutter: ^4.0.0 +``` diff --git a/src/includes/set-environment/flutter.mdx b/src/includes/set-environment/flutter.mdx new file mode 100644 index 0000000000000..7e896e8c44848 --- /dev/null +++ b/src/includes/set-environment/flutter.mdx @@ -0,0 +1,17 @@ +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options.environment = 'staging', + () { + // Run your App + runApp(MyApp()); + }, + ); + + // or define SENTRY_ENVIRONMENT via Dart environment variable (--dart-define) +} + +``` diff --git a/src/includes/set-release/flutter.mdx b/src/includes/set-release/flutter.mdx new file mode 100644 index 0000000000000..ac5fb7443654b --- /dev/null +++ b/src/includes/set-release/flutter.mdx @@ -0,0 +1,17 @@ +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + +void main() async { + await SentryFlutter.init( + (options) => options.release = 'my-project-name@2.3.12+12', + () { + // Run your App + runApp(MyApp()); + }, + ); + + // or define SENTRY_RELEASE via Dart environment variable (--dart-define) +} + +``` From 77aeac7cb161b1bf4c802f7fca7c6e4e862ae680 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 21:56:50 +0100 Subject: [PATCH 37/55] add drain example for Flutter --- src/includes/configuration/drain-example/flutter.mdx | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/includes/configuration/drain-example/flutter.mdx diff --git a/src/includes/configuration/drain-example/flutter.mdx b/src/includes/configuration/drain-example/flutter.mdx new file mode 100644 index 0000000000000..7f2457480ccc0 --- /dev/null +++ b/src/includes/configuration/drain-example/flutter.mdx @@ -0,0 +1 @@ +The Flutter SDK for Android and iOS stores the Sentry events on the device's disk before shutdown. From 0a0267feb7297a26c35014b4416bef60b917eafa Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Nov 2020 22:02:46 +0100 Subject: [PATCH 38/55] fix wizard --- src/wizard/dart/index.md | 23 ++++++++++++++++++ src/wizard/flutter/index.md | 47 +++---------------------------------- 2 files changed, 26 insertions(+), 44 deletions(-) create mode 100644 src/wizard/dart/index.md diff --git a/src/wizard/dart/index.md b/src/wizard/dart/index.md new file mode 100644 index 0000000000000..235eb6a5bb8ad --- /dev/null +++ b/src/wizard/dart/index.md @@ -0,0 +1,23 @@ +--- +name: Dart +doc_link: https://docs.sentry.io/platforms/dart/ +support_level: production +type: framework +--- + +Get the SDK from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: + + + +Import `Sentry` and initialize it: + + + +Capture a test exception: + + + +### Resources + +Flutter has extensive documentation, including a +[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index ecf17b7f09e92..caf89364e221f 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -5,7 +5,7 @@ support_level: production type: framework --- -Get the SDK from from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: +Get the SDK from [pub.dev](https://pub.dev/packages/sentry_flutter) by adding the following to your `pubspec.yaml`: @@ -13,52 +13,11 @@ Import `Sentry` and initialize it: -Run the whole app in a zone to capture all uncaught errors: - -```dart -import 'dart:async'; -import 'package:flutter/widgets.dart'; -import 'package:sentry/sentry.dart'; - -// Wrap your 'runApp(MyApp())' as follows: - -void main() { - runZonedGuarded(() { - runApp(MyApp()); - }, (exception, stackTrace) async { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); - }); -} -``` - -Catch Flutter specific errors by subscribing to `FlutterError.onError`: - -```dart -import 'package:flutter/foundation.dart'; -import 'package:sentry/sentry.dart'; - -void main() { - FlutterError.onError = (FlutterErrorDetails details) async { - await Sentry.captureException( - details.exception, - stackTrace: details.stack, - ); - }; -} -``` - Capture a test exception: ### Resources -Flutter has extensive documentation, which includes a -[cookbook on how to integrate with Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). - -### Source code - -The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). +Flutter has extensive documentation, including a +[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). From 965ed3b38873669dd56a48ef021f4e04f972e11e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 09:19:04 +0100 Subject: [PATCH 39/55] adding missing futures --- src/includes/before-breadcrumb/dart.mdx | 2 +- src/includes/breadcrumbs-example/dart.mdx | 2 +- src/includes/capture-error/dart.mdx | 2 +- src/includes/capture-message/dart.mdx | 2 +- src/includes/configuration/auto-session-tracking/flutter.mdx | 4 ++-- src/includes/configuration/before-breadcrumb-hint/dart.mdx | 2 +- src/includes/configuration/before-send-fingerprint/dart.mdx | 2 +- src/includes/configuration/before-send-hint/dart.mdx | 2 +- src/includes/configuration/before-send/dart.mdx | 2 +- src/includes/configuration/config-intro/dart.mdx | 2 +- src/includes/configuration/config-intro/flutter.mdx | 2 +- src/includes/configuration/sample-rate/dart.mdx | 2 +- .../configuration/session-tracking-interval/flutter.mdx | 4 ++-- src/includes/configure-scope/dart.mdx | 2 +- src/includes/getting-started-config/dart.mdx | 2 +- src/includes/getting-started-config/flutter.mdx | 2 +- src/includes/getting-started-verify/dart.mdx | 2 +- src/includes/set-environment/dart.mdx | 2 +- src/includes/set-fingerprint/basic/dart.mdx | 2 +- src/includes/set-fingerprint/database-connection/dart.mdx | 2 +- src/includes/set-fingerprint/rpc/dart.mdx | 2 +- src/includes/set-fingerprint/static/dart.mdx | 2 +- src/includes/set-release/dart.mdx | 2 +- src/includes/set-release/flutter.mdx | 4 ++-- 24 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/includes/before-breadcrumb/dart.mdx b/src/includes/before-breadcrumb/dart.mdx index 520beb0b089d9..d07f84efd3ff1 100644 --- a/src/includes/before-breadcrumb/dart.mdx +++ b/src/includes/before-breadcrumb/dart.mdx @@ -5,7 +5,7 @@ Breadcrumb beforeBreadcrumb(Breadcrumb breadcrumb, dynamic hint) { return 'a.spammy.Logger' == breadcrumb.category ? null : breadcrumb; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb); } ``` diff --git a/src/includes/breadcrumbs-example/dart.mdx b/src/includes/breadcrumbs-example/dart.mdx index 6103a63d33996..979fef21c5720 100644 --- a/src/includes/breadcrumbs-example/dart.mdx +++ b/src/includes/breadcrumbs-example/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { +Future main() { Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); } ``` diff --git a/src/includes/capture-error/dart.mdx b/src/includes/capture-error/dart.mdx index 80e3432237676..0e322ec87e1c6 100644 --- a/src/includes/capture-error/dart.mdx +++ b/src/includes/capture-error/dart.mdx @@ -3,7 +3,7 @@ In Dart you can capture any exception object that you caught: ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { try { aMethodThatMightFail(); } catch (exception, stackTrace) { diff --git a/src/includes/capture-message/dart.mdx b/src/includes/capture-message/dart.mdx index 0d3b6d081d64a..1b35f6ac6f8aa 100644 --- a/src/includes/capture-message/dart.mdx +++ b/src/includes/capture-message/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { await Sentry.captureMessage('Something went wrong'); } ``` diff --git a/src/includes/configuration/auto-session-tracking/flutter.mdx b/src/includes/configuration/auto-session-tracking/flutter.mdx index 8981b5273ddac..70d646ed9a08a 100644 --- a/src/includes/configuration/auto-session-tracking/flutter.mdx +++ b/src/includes/configuration/auto-session-tracking/flutter.mdx @@ -2,9 +2,9 @@ import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( - (options) => options.enableAutoSessionTracking = true, + (options) => options.enableAutoSessionTracking = true, // it's enabled by default () { // Run your App runApp(MyApp()); diff --git a/src/includes/configuration/before-breadcrumb-hint/dart.mdx b/src/includes/configuration/before-breadcrumb-hint/dart.mdx index d764ab89822cc..c4bf847699003 100644 --- a/src/includes/configuration/before-breadcrumb-hint/dart.mdx +++ b/src/includes/configuration/before-breadcrumb-hint/dart.mdx @@ -5,7 +5,7 @@ Breadcrumb beforeBreadcrumb(Breadcrumb crumb, dynamic hint) { return hint is MyHint ? null : crumb; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb); } ``` diff --git a/src/includes/configuration/before-send-fingerprint/dart.mdx b/src/includes/configuration/before-send-fingerprint/dart.mdx index 051961a81fddf..c8b55dc12d651 100644 --- a/src/includes/configuration/before-send-fingerprint/dart.mdx +++ b/src/includes/configuration/before-send-fingerprint/dart.mdx @@ -8,7 +8,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/configuration/before-send-hint/dart.mdx b/src/includes/configuration/before-send-hint/dart.mdx index d2d0b3d0a6f11..c827b4ede4b7e 100644 --- a/src/includes/configuration/before-send-hint/dart.mdx +++ b/src/includes/configuration/before-send-hint/dart.mdx @@ -7,7 +7,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return hint is MyHint ? null : event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/configuration/before-send/dart.mdx b/src/includes/configuration/before-send/dart.mdx index d806e1ea5e48d..1e61f6b47403d 100644 --- a/src/includes/configuration/before-send/dart.mdx +++ b/src/includes/configuration/before-send/dart.mdx @@ -9,7 +9,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/configuration/config-intro/dart.mdx b/src/includes/configuration/config-intro/dart.mdx index 0eb21bfc6a2e5..c88b9f23ac58c 100644 --- a/src/includes/configuration/config-intro/dart.mdx +++ b/src/includes/configuration/config-intro/dart.mdx @@ -3,7 +3,7 @@ Options are passed to the `Sentry.init` method: ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { await Sentry.init((options) => options ..dsn = '___PUBLIC_DSN___' ..release = 'my-project-name@2.3.12' diff --git a/src/includes/configuration/config-intro/flutter.mdx b/src/includes/configuration/config-intro/flutter.mdx index ade9c0c26b968..d569868abcb9b 100644 --- a/src/includes/configuration/config-intro/flutter.mdx +++ b/src/includes/configuration/config-intro/flutter.mdx @@ -4,7 +4,7 @@ Options are passed to the `SentryFlutter.init` method: import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( (options) => options ..dsn = '___PUBLIC_DSN___' diff --git a/src/includes/configuration/sample-rate/dart.mdx b/src/includes/configuration/sample-rate/dart.mdx index 13a54726c80aa..20dc2bf4c504d 100644 --- a/src/includes/configuration/sample-rate/dart.mdx +++ b/src/includes/configuration/sample-rate/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { // Capture only 25% of events await Sentry.init((options) => options.sampleRate = 0.25); } diff --git a/src/includes/configuration/session-tracking-interval/flutter.mdx b/src/includes/configuration/session-tracking-interval/flutter.mdx index 518b29677f952..ad9f73f5ba1ac 100644 --- a/src/includes/configuration/session-tracking-interval/flutter.mdx +++ b/src/includes/configuration/session-tracking-interval/flutter.mdx @@ -2,9 +2,9 @@ import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( - (options) => options.autoSessionTrackingIntervalMillis = 10000, + (options) => options.autoSessionTrackingIntervalMillis = 10000, // it's 30000 millis by default () { // Run your App runApp(MyApp()); diff --git a/src/includes/configure-scope/dart.mdx b/src/includes/configure-scope/dart.mdx index c4a28f87ba47e..faa4c318fd287 100644 --- a/src/includes/configure-scope/dart.mdx +++ b/src/includes/configure-scope/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +void main() { Sentry.configureScope((scope) => scope ..setTag('my-tag', 'my value') ..user = User(id: '42', email: 'john.doe@example.com')); diff --git a/src/includes/getting-started-config/dart.mdx b/src/includes/getting-started-config/dart.mdx index bc296ef1e206b..e8e713df3822d 100644 --- a/src/includes/getting-started-config/dart.mdx +++ b/src/includes/getting-started-config/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { await Sentry.init((options) => options.dsn = '___PUBLIC_DSN___'); } ``` diff --git a/src/includes/getting-started-config/flutter.mdx b/src/includes/getting-started-config/flutter.mdx index 89a3cc9682ec1..844e3b3be159d 100644 --- a/src/includes/getting-started-config/flutter.mdx +++ b/src/includes/getting-started-config/flutter.mdx @@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( (options) => options.dsn = '___PUBLIC_DSN___', () { diff --git a/src/includes/getting-started-verify/dart.mdx b/src/includes/getting-started-verify/dart.mdx index 66ecf1cc0b5d8..81c4c33c74900 100644 --- a/src/includes/getting-started-verify/dart.mdx +++ b/src/includes/getting-started-verify/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { try { aMethodThatMightFail(); } catch (exception, stackTrace) { diff --git a/src/includes/set-environment/dart.mdx b/src/includes/set-environment/dart.mdx index c5e8373a431b0..9f965d8f01909 100644 --- a/src/includes/set-environment/dart.mdx +++ b/src/includes/set-environment/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { await Sentry.init((options) => options.environment = 'staging'); } ``` diff --git a/src/includes/set-fingerprint/basic/dart.mdx b/src/includes/set-fingerprint/basic/dart.mdx index 051961a81fddf..c8b55dc12d651 100644 --- a/src/includes/set-fingerprint/basic/dart.mdx +++ b/src/includes/set-fingerprint/basic/dart.mdx @@ -8,7 +8,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/set-fingerprint/database-connection/dart.mdx b/src/includes/set-fingerprint/database-connection/dart.mdx index 051961a81fddf..c8b55dc12d651 100644 --- a/src/includes/set-fingerprint/database-connection/dart.mdx +++ b/src/includes/set-fingerprint/database-connection/dart.mdx @@ -8,7 +8,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/set-fingerprint/rpc/dart.mdx b/src/includes/set-fingerprint/rpc/dart.mdx index b6835ea920393..0860a64d66623 100644 --- a/src/includes/set-fingerprint/rpc/dart.mdx +++ b/src/includes/set-fingerprint/rpc/dart.mdx @@ -20,7 +20,7 @@ SentryEvent beforeSend(SentryEvent event, dynamic hint) { return event; } -void main() async { +Future main() async { await Sentry.init((options) => options.beforeSend = beforeSend); } ``` diff --git a/src/includes/set-fingerprint/static/dart.mdx b/src/includes/set-fingerprint/static/dart.mdx index 0668b91ea68de..f3ec788b52a60 100644 --- a/src/includes/set-fingerprint/static/dart.mdx +++ b/src/includes/set-fingerprint/static/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { +Future main() { Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']); } ``` diff --git a/src/includes/set-release/dart.mdx b/src/includes/set-release/dart.mdx index 5fd63edd3b1db..f1071efac422a 100644 --- a/src/includes/set-release/dart.mdx +++ b/src/includes/set-release/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() async { +Future main() async { await Sentry.init((options) => options.release = 'my-project-name@2.3.12+12'); } ``` diff --git a/src/includes/set-release/flutter.mdx b/src/includes/set-release/flutter.mdx index ac5fb7443654b..5928bedcacfe0 100644 --- a/src/includes/set-release/flutter.mdx +++ b/src/includes/set-release/flutter.mdx @@ -2,9 +2,9 @@ import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( - (options) => options.release = 'my-project-name@2.3.12+12', + (options) => options.release = 'my-project-name@2.3.12+12', // this is set automatically for Android and iOS (packageName@versionName+buildNumber) () { // Run your App runApp(MyApp()); From 91315425d6c480ae22f7670e585962d8133932ac Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 09:25:13 +0100 Subject: [PATCH 40/55] fix --- src/includes/breadcrumbs-example/dart.mdx | 2 +- src/includes/set-environment/flutter.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/includes/breadcrumbs-example/dart.mdx b/src/includes/breadcrumbs-example/dart.mdx index 979fef21c5720..6103a63d33996 100644 --- a/src/includes/breadcrumbs-example/dart.mdx +++ b/src/includes/breadcrumbs-example/dart.mdx @@ -1,7 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() { +void main() { Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); } ``` diff --git a/src/includes/set-environment/flutter.mdx b/src/includes/set-environment/flutter.mdx index 7e896e8c44848..5b991012736fe 100644 --- a/src/includes/set-environment/flutter.mdx +++ b/src/includes/set-environment/flutter.mdx @@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -void main() async { +Future main() async { await SentryFlutter.init( (options) => options.environment = 'staging', () { From 2b8d832ef7f514af9c8f8812b940ae7d288e6000 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 10:30:02 +0100 Subject: [PATCH 41/55] added missing focs --- .../getting-started-primer/flutter.mdx | 5 +++ src/platforms/dart/index.mdx | 9 +++++ src/platforms/dart/usage/advanced-usage.mdx | 14 ++++++++ src/platforms/flutter/index.mdx | 9 +++++ .../flutter/usage/advanced-usage.mdx | 34 +++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 src/includes/getting-started-primer/flutter.mdx create mode 100644 src/platforms/dart/usage/advanced-usage.mdx create mode 100644 src/platforms/flutter/usage/advanced-usage.mdx diff --git a/src/includes/getting-started-primer/flutter.mdx b/src/includes/getting-started-primer/flutter.mdx new file mode 100644 index 0000000000000..edbf65ae2d791 --- /dev/null +++ b/src/includes/getting-started-primer/flutter.mdx @@ -0,0 +1,5 @@ + + +_Sentry's Flutter SDK enables capturing sessions for Release Health, offline caching as well as reporting messages and errors._ + + diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index 3b17aef7fd781..a3367afe81a44 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -2,6 +2,15 @@ title: Dart --- +Pure Dart SDK used by any Dart application like AngularDart, CLI and Server. + + + +The Dart SDK v4.0.0 is a Prelease and is under improvements and testing. +Latest stable version is v3.0.1, See #Resources + + + Get the SDK from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: diff --git a/src/platforms/dart/usage/advanced-usage.mdx b/src/platforms/dart/usage/advanced-usage.mdx new file mode 100644 index 0000000000000..95be8a7eac580 --- /dev/null +++ b/src/platforms/dart/usage/advanced-usage.mdx @@ -0,0 +1,14 @@ +--- +title: Advanced Usage +sidebar_order: 2 +--- + +## Requirements + +- For the use of the SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` + +## Tips for catching errors + +- Use a `try/catch` block +- Use a `catchError` block for `Futures` +- Add an `ErrorListener` to your `Isolates` and call `Sentry.captureException` diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index b1e67619aff45..cdc36d2343379 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -2,6 +2,15 @@ title: Flutter --- +Flutter SDK which depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for Android and ObjC, Swift and C for iOS. + + + +The Flutter SDK is a Prelease and is under improvements and testing. +Latest stable version is the Dart SDK v3.0.1, See #Resources + + + Get the SDK from [pub.dev](https://pub.dev/packages/sentry_flutter) by adding the following to your `pubspec.yaml`: diff --git a/src/platforms/flutter/usage/advanced-usage.mdx b/src/platforms/flutter/usage/advanced-usage.mdx new file mode 100644 index 0000000000000..61b14bba127b5 --- /dev/null +++ b/src/platforms/flutter/usage/advanced-usage.mdx @@ -0,0 +1,34 @@ +--- +title: Advanced Usage +sidebar_order: 2 +--- + +## Requirements + +- For the use of the SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` + +## Uploading Debug Symbols (Android and iOS) + +- [iOS dSYM files](/platforms/apple/dsym/) +- [Android NDK](/product/cli/dif/#uploading-files) Do it manually, Do not use the `uploadNativeSymbols` flag from the Sentry Gradle Plugin, it's not supported yet. +- [Android Proguard/R8 mapping file](/platforms/android/proguard/) +- [Flutter Web Source maps](/product/cli/releases/#managing-release-artifacts) + +## Known limitations + +- Flutter `split-debug-info` flag isn't supported yet, if this feature is enabled, Dart stack traces are not useful +- Flutter `obfuscate` flag isn't supported yet, if this feature is enabled, Dart stack traces are not useful + +## Tips for catching errors + +- Use a `try/catch` block +- Use a `catchError` block for `Futures` +- The SDK already runs your init `callback` on an error handler, e.g. using `runZonedGuarded`, are captured automatically +- Flutter-specific errors (such as layout failures), e.g. using `FlutterError.onError`, are captured automatically +- `Isolate` errors on the `current` Isolate which is the equivalent of a main/UI thread, e.g. using `Isolate.current.addErrorListener`, are captured automatically (Only for non-Web Apps). +- For your own `Isolates`, add an `ErrorListener` and call `Sentry.captureException` + +## Advanced Usage (Android and iOS) + +- [iOS Advanced Usage](/platforms/apple/usage/) +- [Android Advanced Usage](/platforms/android/usage/advanced-usage/) From 98944b3ce4bd507ddc76ae37c396fdfc7d396556 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 10:56:06 +0100 Subject: [PATCH 42/55] fix --- src/platforms/dart/index.mdx | 3 +-- src/platforms/dart/usage/advanced-usage.mdx | 2 +- src/platforms/flutter/index.mdx | 5 ++--- src/platforms/flutter/usage/advanced-usage.mdx | 10 +++++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index a3367afe81a44..350077ed91824 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -6,8 +6,7 @@ Pure Dart SDK used by any Dart application like AngularDart, CLI and Server. -The Dart SDK v4.0.0 is a Prelease and is under improvements and testing. -Latest stable version is v3.0.1, See #Resources +The Dart SDK `v4.0.0` is a Prelease and is under improvements and testing, the latest stable version is `v3.0.1` diff --git a/src/platforms/dart/usage/advanced-usage.mdx b/src/platforms/dart/usage/advanced-usage.mdx index 95be8a7eac580..4f397ff2ff205 100644 --- a/src/platforms/dart/usage/advanced-usage.mdx +++ b/src/platforms/dart/usage/advanced-usage.mdx @@ -5,7 +5,7 @@ sidebar_order: 2 ## Requirements -- For the use of the SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` +- For the usage of the Dart SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` ## Tips for catching errors diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index cdc36d2343379..599ac1177a3c0 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -2,12 +2,11 @@ title: Flutter --- -Flutter SDK which depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for Android and ObjC, Swift and C for iOS. +The Flutter SDK depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for Android and ObjC, Swift and C for iOS. -The Flutter SDK is a Prelease and is under improvements and testing. -Latest stable version is the Dart SDK v3.0.1, See #Resources +The Flutter SDK is a Prelease and is under improvements and testing, the latest stable version is the Dart SDK `v3.0.1` diff --git a/src/platforms/flutter/usage/advanced-usage.mdx b/src/platforms/flutter/usage/advanced-usage.mdx index 61b14bba127b5..00b4fe23625bf 100644 --- a/src/platforms/flutter/usage/advanced-usage.mdx +++ b/src/platforms/flutter/usage/advanced-usage.mdx @@ -5,14 +5,14 @@ sidebar_order: 2 ## Requirements -- For the use of the SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` +For the usage of the Flutter SDK, the minimal required Dart SDK version is `2.8.0` and Flutter SDK version is `1.17.0` ## Uploading Debug Symbols (Android and iOS) - [iOS dSYM files](/platforms/apple/dsym/) -- [Android NDK](/product/cli/dif/#uploading-files) Do it manually, Do not use the `uploadNativeSymbols` flag from the Sentry Gradle Plugin, it's not supported yet. +- [Android NDK](/product/cli/dif/#uploading-files), You've to do it manually, Do not use the `uploadNativeSymbols` flag from the [Sentry Gradle Plugin](/platforms/android/proguard/), it's not supported yet. - [Android Proguard/R8 mapping file](/platforms/android/proguard/) -- [Flutter Web Source maps](/product/cli/releases/#managing-release-artifacts) +- [Source maps for Flutter Web](/product/cli/releases/#managing-release-artifacts) ## Known limitations @@ -32,3 +32,7 @@ sidebar_order: 2 - [iOS Advanced Usage](/platforms/apple/usage/) - [Android Advanced Usage](/platforms/android/usage/advanced-usage/) + +## Dart environment variables + +- You can configure the SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST and SENTRY_ENVIRONMENT via the Dart environment variables passing the `--dart-define` flag to the compiler. From 9d13d2596c1b6b29204228ad85f4defe67d5bfc7 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 11:08:34 +0100 Subject: [PATCH 43/55] add prime content --- src/includes/getting-started-primer/dart.mdx | 5 +++++ src/includes/getting-started-primer/flutter.mdx | 2 ++ src/platforms/dart/index.mdx | 2 +- src/platforms/flutter/index.mdx | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/includes/getting-started-primer/dart.mdx diff --git a/src/includes/getting-started-primer/dart.mdx b/src/includes/getting-started-primer/dart.mdx new file mode 100644 index 0000000000000..0bd2f5f2d252b --- /dev/null +++ b/src/includes/getting-started-primer/dart.mdx @@ -0,0 +1,5 @@ + + +_Pure Dart SDK used by any Dart application like AngularDart, CLI and Server, it enables reporting messages and errors._ + + diff --git a/src/includes/getting-started-primer/flutter.mdx b/src/includes/getting-started-primer/flutter.mdx index edbf65ae2d791..6f8bae740e9ea 100644 --- a/src/includes/getting-started-primer/flutter.mdx +++ b/src/includes/getting-started-primer/flutter.mdx @@ -2,4 +2,6 @@ _Sentry's Flutter SDK enables capturing sessions for Release Health, offline caching as well as reporting messages and errors._ +_Sentry's Flutter SDK depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for `Android` and ObjC, Swift and C for `iOS`._ + diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index 350077ed91824..be74f4bc75562 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -2,7 +2,7 @@ title: Dart --- -Pure Dart SDK used by any Dart application like AngularDart, CLI and Server. + diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 599ac1177a3c0..bf53280a4dbc4 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -2,7 +2,7 @@ title: Flutter --- -The Flutter SDK depends on the [Dart SDK](/platforms/dart/) and includes support to native crashes through Sentry's native SDKs (Android and iOS), It'll capture errors in the native layer, including Java, Kotlin, C and C++ code for Android and ObjC, Swift and C for iOS. + From 7ff5ac20d013953249960e4648a65df813789cca Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 20:31:05 +0100 Subject: [PATCH 44/55] fixes --- src/platforms/common/configuration/draining.mdx | 1 + src/platforms/dart/config.yml | 2 +- src/platforms/dart/index.mdx | 13 ++++++++----- src/platforms/flutter/config.yml | 3 ++- src/platforms/flutter/index.mdx | 2 +- src/wizard/dart/index.md | 5 ++--- src/wizard/flutter/index.md | 5 ++--- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/platforms/common/configuration/draining.mdx b/src/platforms/common/configuration/draining.mdx index 5f462348a7e7c..a45e227481ae6 100644 --- a/src/platforms/common/configuration/draining.mdx +++ b/src/platforms/common/configuration/draining.mdx @@ -4,6 +4,7 @@ sidebar_order: 5 description: "Learn more about the default behavior of our SDK if the application shuts down unexpectedly." notSupported: - perl + - dart --- The default behavior of most SDKs is to send out events over the network diff --git a/src/platforms/dart/config.yml b/src/platforms/dart/config.yml index d0e4ae1e10c60..6c90f11e5db79 100644 --- a/src/platforms/dart/config.yml +++ b/src/platforms/dart/config.yml @@ -1,4 +1,4 @@ title: Dart -caseStyle: canonical +caseStyle: camelCase supportLevel: production sdk: sentry.dart diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index be74f4bc75562..81087f81af16b 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -10,6 +10,12 @@ The Dart SDK `v4.0.0` is a Prelease and is under improvements and testing, the l + + +For Flutter apps, please refer to the [Flutter integration](/platforms/flutter) instead. + + + Get the SDK from [pub.dev](https://pub.dev/packages/sentry) by adding the following to your `pubspec.yaml`: @@ -22,11 +28,8 @@ Capture a test exception: -### Resources - -Flutter has extensive documentation, including a -[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). - ### Source code The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). + + diff --git a/src/platforms/flutter/config.yml b/src/platforms/flutter/config.yml index 7fe956d29c000..ae1eb343eb012 100644 --- a/src/platforms/flutter/config.yml +++ b/src/platforms/flutter/config.yml @@ -1,8 +1,9 @@ title: Flutter -caseStyle: canonical +caseStyle: camelCase supportLevel: production sdk: sentry.dart.flutter fallbackPlatform: dart categories: - mobile - browser + - server diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index bf53280a4dbc4..5518f0d9a9a5e 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -24,7 +24,7 @@ Capture a test exception: ### Resources -Flutter has extensive documentation, including a +The Flutter website has extensive documentation, including a [cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). ### Source code diff --git a/src/wizard/dart/index.md b/src/wizard/dart/index.md index 235eb6a5bb8ad..c04cef941e641 100644 --- a/src/wizard/dart/index.md +++ b/src/wizard/dart/index.md @@ -17,7 +17,6 @@ Capture a test exception: -### Resources +### Next steps -Flutter has extensive documentation, including a -[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). +Check out the [Dart documentation](http://docs.sentry.io/platforms/dart/) to learn about configuration options available. diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index caf89364e221f..295adb00c891b 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -17,7 +17,6 @@ Capture a test exception: -### Resources +### Next steps -Flutter has extensive documentation, including a -[cookbook on integrating with a Sentry version earlier than 4.0.0](https://flutter.dev/docs/cookbook/maintenance/error-reporting). +Check out the [Flutter documentation](http://docs.sentry.io/platforms/flutter/) to learn about configuration options available. From 3557f318221d6974af0552771c0d79a49087d51e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 20:46:26 +0100 Subject: [PATCH 45/55] remove main method from non init methods --- src/includes/capture-error/dart.mdx | 16 +++++++--------- src/includes/capture-message/dart.mdx | 4 +--- src/includes/configure-scope/dart.mdx | 8 +++----- src/includes/getting-started-verify/dart.mdx | 16 +++++++--------- src/includes/sensitive-data/set-tag/dart.mdx | 10 ++++------ src/includes/sensitive-data/set-user/dart.mdx | 10 ++++------ src/includes/set-context/dart.mdx | 12 +++++------- src/includes/set-extra/dart.mdx | 10 ++++------ src/includes/set-fingerprint/static/dart.mdx | 4 +--- src/includes/set-level/dart.mdx | 4 +--- src/includes/set-tag/dart.mdx | 4 +--- src/includes/set-user/dart.mdx | 8 +++----- src/includes/unset-user/dart.mdx | 4 +--- 13 files changed, 42 insertions(+), 68 deletions(-) diff --git a/src/includes/capture-error/dart.mdx b/src/includes/capture-error/dart.mdx index 0e322ec87e1c6..5c6c58f4c4827 100644 --- a/src/includes/capture-error/dart.mdx +++ b/src/includes/capture-error/dart.mdx @@ -3,14 +3,12 @@ In Dart you can capture any exception object that you caught: ```dart import 'package:sentry/sentry.dart'; -Future main() async { - try { - aMethodThatMightFail(); - } catch (exception, stackTrace) { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); - } +try { + aMethodThatMightFail(); +} catch (exception, stackTrace) { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); } ``` diff --git a/src/includes/capture-message/dart.mdx b/src/includes/capture-message/dart.mdx index 1b35f6ac6f8aa..6eed62afe6dd4 100644 --- a/src/includes/capture-message/dart.mdx +++ b/src/includes/capture-message/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() async { - await Sentry.captureMessage('Something went wrong'); -} +await Sentry.captureMessage('Something went wrong'); ``` diff --git a/src/includes/configure-scope/dart.mdx b/src/includes/configure-scope/dart.mdx index faa4c318fd287..ded5ae24e652b 100644 --- a/src/includes/configure-scope/dart.mdx +++ b/src/includes/configure-scope/dart.mdx @@ -1,9 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope - ..setTag('my-tag', 'my value') - ..user = User(id: '42', email: 'john.doe@example.com')); -} +Sentry.configureScope((scope) => scope + ..setTag('my-tag', 'my value') + ..user = User(id: '42', email: 'john.doe@example.com')); ``` diff --git a/src/includes/getting-started-verify/dart.mdx b/src/includes/getting-started-verify/dart.mdx index 81c4c33c74900..8fa5050949bc5 100644 --- a/src/includes/getting-started-verify/dart.mdx +++ b/src/includes/getting-started-verify/dart.mdx @@ -1,14 +1,12 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() async { - try { - aMethodThatMightFail(); - } catch (exception, stackTrace) { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); - } +try { + aMethodThatMightFail(); +} catch (exception, stackTrace) { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); } ``` diff --git a/src/includes/sensitive-data/set-tag/dart.mdx b/src/includes/sensitive-data/set-tag/dart.mdx index bc2d1ab4661ac..a42e97256cd6c 100644 --- a/src/includes/sensitive-data/set-tag/dart.mdx +++ b/src/includes/sensitive-data/set-tag/dart.mdx @@ -1,10 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.setTag( - 'birthday', - checksumOrHash('08/12/1990'), - )); -} +Sentry.configureScope((scope) => scope.setTag( + 'birthday', + checksumOrHash('08/12/1990'), + )); ``` diff --git a/src/includes/sensitive-data/set-user/dart.mdx b/src/includes/sensitive-data/set-user/dart.mdx index f5569b8226f03..037fc4e96536e 100644 --- a/src/includes/sensitive-data/set-user/dart.mdx +++ b/src/includes/sensitive-data/set-user/dart.mdx @@ -1,10 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.user = User( - id: clientUser.id, - username: clientUser.username, - )); -} +Sentry.configureScope((scope) => scope.user = User( + id: clientUser.id, + username: clientUser.username, + )); ``` diff --git a/src/includes/set-context/dart.mdx b/src/includes/set-context/dart.mdx index 13ed861e90617..612497e509bac 100644 --- a/src/includes/set-context/dart.mdx +++ b/src/includes/set-context/dart.mdx @@ -1,11 +1,9 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - final person = { - 'name': 'Mighty Fighter', - 'age': '19', - }; - Sentry.configureScope((scope) => scope.setContexts('person', person)); -} +final person = { + 'name': 'Mighty Fighter', + 'age': '19', +}; +Sentry.configureScope((scope) => scope.setContexts('person', person)); ``` diff --git a/src/includes/set-extra/dart.mdx b/src/includes/set-extra/dart.mdx index 929c8557e2719..a3dce1ae9517e 100644 --- a/src/includes/set-extra/dart.mdx +++ b/src/includes/set-extra/dart.mdx @@ -1,10 +1,8 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.setExtra( - 'character.name', - 'Mighty Fighter', - )); -} +Sentry.configureScope((scope) => scope.setExtra( + 'character.name', + 'Mighty Fighter', + )); ``` diff --git a/src/includes/set-fingerprint/static/dart.mdx b/src/includes/set-fingerprint/static/dart.mdx index f3ec788b52a60..6de02829f9154 100644 --- a/src/includes/set-fingerprint/static/dart.mdx +++ b/src/includes/set-fingerprint/static/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -Future main() { - Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']); -} +Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']); ``` diff --git a/src/includes/set-level/dart.mdx b/src/includes/set-level/dart.mdx index 733a955c82cfa..8f9bd839be1c3 100644 --- a/src/includes/set-level/dart.mdx +++ b/src/includes/set-level/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.level = SentryLevel.warning); -} +Sentry.configureScope((scope) => scope.level = SentryLevel.warning); ``` diff --git a/src/includes/set-tag/dart.mdx b/src/includes/set-tag/dart.mdx index 38e18c951669d..1668e2dfc9c93 100644 --- a/src/includes/set-tag/dart.mdx +++ b/src/includes/set-tag/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.setTag('page.locale', 'pt-BR')); -} +Sentry.configureScope((scope) => scope.setTag('page.locale', 'pt-BR')); ``` diff --git a/src/includes/set-user/dart.mdx b/src/includes/set-user/dart.mdx index 35295f9785c73..a9ddeda2f1a11 100644 --- a/src/includes/set-user/dart.mdx +++ b/src/includes/set-user/dart.mdx @@ -1,9 +1,7 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope( - (scope) => scope.user = User(email: 'jane.doe@example.com'), - ); -} +Sentry.configureScope( + (scope) => scope.user = User(email: 'jane.doe@example.com'), +); ``` diff --git a/src/includes/unset-user/dart.mdx b/src/includes/unset-user/dart.mdx index b17e2790a48fc..67556d06ddab4 100644 --- a/src/includes/unset-user/dart.mdx +++ b/src/includes/unset-user/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.configureScope((scope) => scope.user = null); -} +Sentry.configureScope((scope) => scope.user = null); ``` From 6aaa299f5ed770549d27927f7acdde13e8d44ed0 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 20:59:56 +0100 Subject: [PATCH 46/55] fix --- src/includes/breadcrumbs-example/dart.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/includes/breadcrumbs-example/dart.mdx b/src/includes/breadcrumbs-example/dart.mdx index 6103a63d33996..306e6a8843a57 100644 --- a/src/includes/breadcrumbs-example/dart.mdx +++ b/src/includes/breadcrumbs-example/dart.mdx @@ -1,7 +1,5 @@ ```dart import 'package:sentry/sentry.dart'; -void main() { - Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); -} +Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user')); ``` From 23a9774dd826ae9387e47f0172532bfb9c93de8a Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 21:02:13 +0100 Subject: [PATCH 47/55] workaround --- src/wizard/dart/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wizard/dart/index.md b/src/wizard/dart/index.md index c04cef941e641..8e10f8b618753 100644 --- a/src/wizard/dart/index.md +++ b/src/wizard/dart/index.md @@ -19,4 +19,4 @@ Capture a test exception: ### Next steps -Check out the [Dart documentation](http://docs.sentry.io/platforms/dart/) to learn about configuration options available. +Check out the [Dart documentation](https://sentry-docs-git-ref-flutter-v4.sentry.dev/platforms/dart/) to learn about configuration options available. From 62269873745449bc6460f6cd220d9676987253e0 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 21:14:53 +0100 Subject: [PATCH 48/55] remove links --- src/wizard/dart/index.md | 4 ---- src/wizard/flutter/index.md | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/wizard/dart/index.md b/src/wizard/dart/index.md index 8e10f8b618753..2c5cdc2cd27f7 100644 --- a/src/wizard/dart/index.md +++ b/src/wizard/dart/index.md @@ -16,7 +16,3 @@ Import `Sentry` and initialize it: Capture a test exception: - -### Next steps - -Check out the [Dart documentation](https://sentry-docs-git-ref-flutter-v4.sentry.dev/platforms/dart/) to learn about configuration options available. diff --git a/src/wizard/flutter/index.md b/src/wizard/flutter/index.md index 295adb00c891b..a031e6d144015 100644 --- a/src/wizard/flutter/index.md +++ b/src/wizard/flutter/index.md @@ -16,7 +16,3 @@ Import `Sentry` and initialize it: Capture a test exception: - -### Next steps - -Check out the [Flutter documentation](http://docs.sentry.io/platforms/flutter/) to learn about configuration options available. From 4ba299f93f313bdbf0349360f6cada442a05f214 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 21:37:40 +0100 Subject: [PATCH 49/55] fixes --- src/platforms/common/configuration/options.mdx | 6 +++--- src/platforms/common/enriching-events/user-feedback.mdx | 1 + src/platforms/flutter/usage/advanced-usage.mdx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platforms/common/configuration/options.mdx b/src/platforms/common/configuration/options.mdx index 21f7f0365bec1..6af2a7ec89f49 100644 --- a/src/platforms/common/configuration/options.mdx +++ b/src/platforms/common/configuration/options.mdx @@ -81,7 +81,7 @@ If possible, we recommended turning on this feature to send all such data by def - + This option can be used to supply a "server name." When provided, the name of the server is sent along and persisted in the event. For many integrations the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server. Most SDKs will attempt to auto-discover this value. @@ -101,13 +101,13 @@ will be sent. This is a "contains" match to the entire file URL. As a result, if - + A list of string prefixes of module names that belong to the app. This option takes precedence over `in-app-exclude`. - + A list of string prefixes of module names that do not belong to the app, but rather to third-party packages. Modules considered not part of the app will be hidden from stack traces by default. diff --git a/src/platforms/common/enriching-events/user-feedback.mdx b/src/platforms/common/enriching-events/user-feedback.mdx index d922b2be41307..b1bea878a4c2b 100644 --- a/src/platforms/common/enriching-events/user-feedback.mdx +++ b/src/platforms/common/enriching-events/user-feedback.mdx @@ -18,6 +18,7 @@ notSupported: - native.crashpad - native.minidumps - native.ue4 + - dart --- When a user experiences an error, Sentry provides the ability to collect additional feedback. This type of feedback is useful when you may typically render a plain error page (the classic `500.html`). diff --git a/src/platforms/flutter/usage/advanced-usage.mdx b/src/platforms/flutter/usage/advanced-usage.mdx index 00b4fe23625bf..78667a300aeff 100644 --- a/src/platforms/flutter/usage/advanced-usage.mdx +++ b/src/platforms/flutter/usage/advanced-usage.mdx @@ -35,4 +35,4 @@ For the usage of the Flutter SDK, the minimal required Dart SDK version is `2.8. ## Dart environment variables -- You can configure the SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST and SENTRY_ENVIRONMENT via the Dart environment variables passing the `--dart-define` flag to the compiler. +- You can configure the `SENTRY_DSN`, `SENTRY_RELEASE`, `SENTRY_DIST` and `SENTRY_ENVIRONMENT` via the Dart environment variables passing the `--dart-define` flag to the compiler. From ef0c598412ffc8d258d9a834d7b609afe26faa95 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 21:50:27 +0100 Subject: [PATCH 50/55] fix --- src/platforms/common/data-management/sensitive-data/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/common/data-management/sensitive-data/index.mdx b/src/platforms/common/data-management/sensitive-data/index.mdx index 925df7d0f1a34..c0ea922695e51 100644 --- a/src/platforms/common/data-management/sensitive-data/index.mdx +++ b/src/platforms/common/data-management/sensitive-data/index.mdx @@ -17,7 +17,7 @@ There are two great examples for data scrubbing that every company should think ## Personally Identifiable Information (PII) - + Our newer SDKs do not purposefully send PII to stay on the safe side. This behavior is controlled by an option called [`send-default-pii`](../../configuration/options/#send-default-pii). From ad64d3efb6fb3be95c6c4e3a606bfc299b67659b Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 21:53:52 +0100 Subject: [PATCH 51/55] add next steps --- src/platforms/dart/index.mdx | 2 ++ src/platforms/flutter/index.mdx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index 81087f81af16b..9c10dcb184ced 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -33,3 +33,5 @@ Capture a test exception: The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). + + diff --git a/src/platforms/flutter/index.mdx b/src/platforms/flutter/index.mdx index 5518f0d9a9a5e..5557707a0cf32 100644 --- a/src/platforms/flutter/index.mdx +++ b/src/platforms/flutter/index.mdx @@ -30,3 +30,5 @@ The Flutter website has extensive documentation, including a ### Source code The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). + + From 5345289e75a03d0a38a4a1abe03ca62723e3e821 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 22:04:14 +0100 Subject: [PATCH 52/55] added dart and flutter to not supported for PII --- src/platforms/common/data-management/sensitive-data/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/common/data-management/sensitive-data/index.mdx b/src/platforms/common/data-management/sensitive-data/index.mdx index c0ea922695e51..631cb89e8bc63 100644 --- a/src/platforms/common/data-management/sensitive-data/index.mdx +++ b/src/platforms/common/data-management/sensitive-data/index.mdx @@ -17,7 +17,7 @@ There are two great examples for data scrubbing that every company should think ## Personally Identifiable Information (PII) - + Our newer SDKs do not purposefully send PII to stay on the safe side. This behavior is controlled by an option called [`send-default-pii`](../../configuration/options/#send-default-pii). From 94eb169b1f467d49777025db3aad9fc4ca31cea8 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 25 Nov 2020 22:27:37 +0100 Subject: [PATCH 53/55] remove duplicated next steps --- src/platforms/dart/index.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/platforms/dart/index.mdx b/src/platforms/dart/index.mdx index 9c10dcb184ced..81087f81af16b 100644 --- a/src/platforms/dart/index.mdx +++ b/src/platforms/dart/index.mdx @@ -33,5 +33,3 @@ Capture a test exception: The Sentry Dart/Flutter SDK can be found on GitHub [`sentry-dart`](https://github.com/getsentry/sentry-dart/). - - From bb1389ccc6b20be3519ddffcad26f42704d973cb Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 26 Nov 2020 09:06:37 +0100 Subject: [PATCH 54/55] hide user feedback for flutter --- src/platforms/common/enriching-events/user-feedback.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/common/enriching-events/user-feedback.mdx b/src/platforms/common/enriching-events/user-feedback.mdx index b1bea878a4c2b..e1e45c53fe8b9 100644 --- a/src/platforms/common/enriching-events/user-feedback.mdx +++ b/src/platforms/common/enriching-events/user-feedback.mdx @@ -19,6 +19,7 @@ notSupported: - native.minidumps - native.ue4 - dart + - flutter --- When a user experiences an error, Sentry provides the ability to collect additional feedback. This type of feedback is useful when you may typically render a plain error page (the classic `500.html`). From 2f6624747f584e6eb864839f3a5f589c84659ab6 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 26 Nov 2020 09:19:49 +0100 Subject: [PATCH 55/55] add caveat section --- src/platforms/flutter/usage/advanced-usage.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platforms/flutter/usage/advanced-usage.mdx b/src/platforms/flutter/usage/advanced-usage.mdx index 78667a300aeff..4eb3f996b36a4 100644 --- a/src/platforms/flutter/usage/advanced-usage.mdx +++ b/src/platforms/flutter/usage/advanced-usage.mdx @@ -28,6 +28,10 @@ For the usage of the Flutter SDK, the minimal required Dart SDK version is `2.8. - `Isolate` errors on the `current` Isolate which is the equivalent of a main/UI thread, e.g. using `Isolate.current.addErrorListener`, are captured automatically (Only for non-Web Apps). - For your own `Isolates`, add an `ErrorListener` and call `Sentry.captureException` +## Caveat + +Always prefer the `SentryFlutter.init(...)` instead of `Sentry.init(...)` as it adds the Flutter integrations on top of the Dart SDK. + ## Advanced Usage (Android and iOS) - [iOS Advanced Usage](/platforms/apple/usage/)