Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the Dart/Flutter SDK to v4 #2599

Merged
merged 56 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
95424be
fix
marandaneto Oct 27, 2020
9e22b47
Update src/platforms/flutter/index.mdx
marandaneto Oct 27, 2020
1052fb9
added missing docs
marandaneto Oct 28, 2020
2e0feb3
Update src/includes/configure-scope/flutter.mdx
marandaneto Oct 28, 2020
07c46c0
Update src/includes/sensitive-data/set-tag/flutter.mdx
marandaneto Oct 28, 2020
72bd0b0
Update src/includes/sensitive-data/set-user/flutter.mdx
marandaneto Oct 28, 2020
c3f4863
fix
marandaneto Oct 28, 2020
32873b3
added missing docs
marandaneto Oct 28, 2020
f0e6844
fix
marandaneto Oct 28, 2020
449c51e
fix
marandaneto Oct 28, 2020
3f4ebfe
fix
marandaneto Oct 28, 2020
749de8c
wizard
marandaneto Oct 28, 2020
b5acf5b
fixes
marandaneto Oct 28, 2020
6118def
import
marandaneto Oct 28, 2020
5e19fcd
Update src/platforms/flutter/index.mdx
marandaneto Oct 28, 2020
e68c585
Update src/wizard/flutter/index.md
marandaneto Oct 28, 2020
c97b4a2
Update src/includes/configuration/config-intro/flutter.mdx
marandaneto Oct 29, 2020
be0c372
Update src/includes/configuration/sample-rate/flutter.mdx
marandaneto Oct 29, 2020
dde61c9
Update src/includes/set-tag/flutter.mdx
marandaneto Oct 29, 2020
db8514a
Update src/includes/set-environment/flutter.mdx
marandaneto Oct 29, 2020
82b5a62
Update src/platforms/flutter/index.mdx
marandaneto Oct 29, 2020
b122ad4
Update src/platforms/flutter/index.mdx
marandaneto Oct 29, 2020
2bdfb17
Update src/includes/capture-error/flutter.mdx
marandaneto Oct 30, 2020
ec5cc38
Update src/includes/capture-error/flutter.mdx
marandaneto Oct 30, 2020
c0f1b6a
Update src/includes/capture-message/flutter.mdx
marandaneto Oct 30, 2020
15f0de2
Update src/includes/getting-started-verify/flutter.mdx
marandaneto Oct 30, 2020
e22b3a8
Update src/includes/set-user/flutter.mdx
marandaneto Oct 30, 2020
1158de1
Update src/includes/getting-started-verify/flutter.mdx
marandaneto Oct 30, 2020
f68660f
fix examples
marandaneto Oct 30, 2020
0af20ff
Merge branch 'master' into ref/flutter-v4
marandaneto Nov 23, 2020
a8ebb39
add new platform
marandaneto Nov 24, 2020
9fecdd6
add index
marandaneto Nov 24, 2020
e7b0203
rename files
marandaneto Nov 24, 2020
3585c1a
ref
marandaneto Nov 24, 2020
be43f25
no need of future main methods
marandaneto Nov 24, 2020
8048aec
fix dart files
marandaneto Nov 24, 2020
5315d67
add specific Flutter files
marandaneto Nov 24, 2020
77aeac7
add drain example for Flutter
marandaneto Nov 24, 2020
0a0267f
fix wizard
marandaneto Nov 24, 2020
965ed3b
adding missing futures
marandaneto Nov 25, 2020
9131542
fix
marandaneto Nov 25, 2020
2b8d832
added missing focs
marandaneto Nov 25, 2020
98944b3
fix
marandaneto Nov 25, 2020
9d13d25
add prime content
marandaneto Nov 25, 2020
7ff5ac2
fixes
marandaneto Nov 25, 2020
3557f31
remove main method from non init methods
marandaneto Nov 25, 2020
6aaa299
fix
marandaneto Nov 25, 2020
23a9774
workaround
marandaneto Nov 25, 2020
6226987
remove links
marandaneto Nov 25, 2020
4ba299f
fixes
marandaneto Nov 25, 2020
ef0c598
fix
marandaneto Nov 25, 2020
ad64d3e
add next steps
marandaneto Nov 25, 2020
5345289
added dart and flutter to not supported for PII
marandaneto Nov 25, 2020
94eb169
remove duplicated next steps
marandaneto Nov 25, 2020
bb1389c
hide user feedback for flutter
marandaneto Nov 26, 2020
2f66247
add caveat section
marandaneto Nov 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/includes/before-breadcrumb/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```dart
import 'package:sentry/sentry.dart';

Breadcrumb beforeBreadcrumb(Breadcrumb breadcrumb, dynamic hint) {
return 'a.spammy.Logger' == breadcrumb.category ? null : breadcrumb;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb);
}
```
5 changes: 5 additions & 0 deletions src/includes/breadcrumbs-example/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user'));
```
14 changes: 14 additions & 0 deletions src/includes/capture-error/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
In Dart you can capture any exception object that you caught:

```dart
import 'package:sentry/sentry.dart';

try {
aMethodThatMightFail();
} catch (exception, stackTrace) {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
}
```
12 changes: 0 additions & 12 deletions src/includes/capture-error/flutter.mdx

This file was deleted.

5 changes: 5 additions & 0 deletions src/includes/capture-message/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

await Sentry.captureMessage('Something went wrong');
```
3 changes: 0 additions & 3 deletions src/includes/capture-message/flutter.mdx

This file was deleted.

14 changes: 14 additions & 0 deletions src/includes/configuration/auto-session-tracking/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```dart
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) => options.enableAutoSessionTracking = true, // it's enabled by default
() {
// Run your App
runApp(MyApp());
},
);
}
```
11 changes: 11 additions & 0 deletions src/includes/configuration/before-breadcrumb-hint/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```dart
import 'package:sentry/sentry.dart';

Breadcrumb beforeBreadcrumb(Breadcrumb crumb, dynamic hint) {
return hint is MyHint ? null : crumb;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeBreadcrumb = beforeBreadcrumb);
}
```
14 changes: 14 additions & 0 deletions src/includes/configuration/before-send-fingerprint/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```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;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeSend = beforeSend);
}
```
13 changes: 13 additions & 0 deletions src/includes/configuration/before-send-hint/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
A `BiFunction<SentryEvent, Object, SentryEvent>` 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;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeSend = beforeSend);
}
```
15 changes: 15 additions & 0 deletions src/includes/configuration/before-send/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
A `BiFunction<SentryEvent, Object, SentryEvent>` 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;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeSend = beforeSend);
}
```
12 changes: 12 additions & 0 deletions src/includes/configuration/config-intro/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Options are passed to the `Sentry.init` method:

```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init((options) => options
..dsn = '___PUBLIC_DSN___'
..release = '[email protected]'
..environment = 'staging');
}
```
24 changes: 16 additions & 8 deletions src/includes/configuration/config-intro/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Options are passed to the `SentryClient()` class:
Options are passed to the `SentryFlutter.init` method:

```dart
final sentry = SentryClient(
dsn: '___PUBLIC_DSN___',
environmentAttributes: const Event(
release: '[email protected]',
environment: 'production',
)
);
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) => options
..dsn = '___PUBLIC_DSN___'
..release = '[email protected]'
..environment = 'staging',
() {
// Run your App
runApp(MyApp());
},
);
}
```
1 change: 1 addition & 0 deletions src/includes/configuration/drain-example/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Flutter SDK for Android and iOS stores the Sentry events on the device's disk before shutdown.
8 changes: 8 additions & 0 deletions src/includes/configuration/sample-rate/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
// Capture only 25% of events
await Sentry.init((options) => options.sampleRate = 0.25);
}
```
14 changes: 14 additions & 0 deletions src/includes/configuration/session-tracking-interval/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```dart
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) => options.autoSessionTrackingIntervalMillis = 10000, // it's 30000 millis by default
() {
// Run your App
runApp(MyApp());
},
);
}
```
7 changes: 7 additions & 0 deletions src/includes/configure-scope/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope
..setTag('my-tag', 'my value')
..user = User(id: '42', email: '[email protected]'));
```
7 changes: 7 additions & 0 deletions src/includes/getting-started-config/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init((options) => options.dsn = '___PUBLIC_DSN___');
}
```
16 changes: 16 additions & 0 deletions src/includes/getting-started-config/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```dart
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
await SentryFlutter.init(
(options) => options.dsn = '___PUBLIC_DSN___',
() {
// Run your App
runApp(MyApp());
},
);

// or define SENTRY_DSN via Dart environment variable (--dart-define)
}
```
4 changes: 4 additions & 0 deletions src/includes/getting-started-install/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```yml {filename:pubspec.yaml}
dependencies:
sentry: ^4.0.0
```
4 changes: 4 additions & 0 deletions src/includes/getting-started-install/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```yml {filename:pubspec.yaml}
dependencies:
sentry_flutter: ^4.0.0
```
5 changes: 5 additions & 0 deletions src/includes/getting-started-primer/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Note>

_Pure Dart SDK used by any Dart application like AngularDart, CLI and Server, it enables reporting messages and errors._

</Note>
7 changes: 7 additions & 0 deletions src/includes/getting-started-primer/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Note>

_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`._

</Note>
12 changes: 12 additions & 0 deletions src/includes/getting-started-verify/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```dart
import 'package:sentry/sentry.dart';

try {
aMethodThatMightFail();
} catch (exception, stackTrace) {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
}
```
8 changes: 8 additions & 0 deletions src/includes/sensitive-data/set-tag/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.setTag(
'birthday',
checksumOrHash('08/12/1990'),
));
```
8 changes: 8 additions & 0 deletions src/includes/sensitive-data/set-user/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.user = User(
id: clientUser.id,
username: clientUser.username,
));
```
9 changes: 9 additions & 0 deletions src/includes/set-context/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```dart
import 'package:sentry/sentry.dart';

final person = {
'name': 'Mighty Fighter',
'age': '19',
};
Sentry.configureScope((scope) => scope.setContexts('person', person));
```
13 changes: 0 additions & 13 deletions src/includes/set-context/flutter.mdx

This file was deleted.

7 changes: 7 additions & 0 deletions src/includes/set-environment/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init((options) => options.environment = 'staging');
}
```
20 changes: 14 additions & 6 deletions src/includes/set-environment/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
```dart
import 'package:sentry/sentry.dart';
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<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)
}

final sentry = SentryClient(
environmentAttributes: const Event(
environment: 'production'
)
);
```
8 changes: 8 additions & 0 deletions src/includes/set-extra/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.setExtra(
'character.name',
'Mighty Fighter',
));
```
9 changes: 0 additions & 9 deletions src/includes/set-extra/flutter.mdx

This file was deleted.

14 changes: 14 additions & 0 deletions src/includes/set-fingerprint/basic/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```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;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeSend = beforeSend);
}
```
14 changes: 14 additions & 0 deletions src/includes/set-fingerprint/database-connection/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```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;
}

Future<void> main() async {
await Sentry.init((options) => options.beforeSend = beforeSend);
}
```
Loading