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 20 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
9 changes: 9 additions & 0 deletions src/includes/before-breadcrumb/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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.beforeBreadcrumb = beforeBreadCrumb);
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
```
19 changes: 19 additions & 0 deletions src/includes/breadcrumbs-example/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```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

Sentry.addBreadcrumb(Breadcrumb(message: 'Authenticated user'));
```
25 changes: 16 additions & 9 deletions src/includes/capture-error/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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 caught:

```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);
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
}

// or

try {
throw 'Not implemented';
} catch (exception, stackTrace) {
Sentry.captureException(exception, stackTrace: stackTrace);
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
}
```
4 changes: 3 additions & 1 deletion src/includes/capture-message/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
```dart
sentry.captureEvent(const Event(message: 'Something went wrong'));
import 'package:sentry/sentry.dart';

Sentry.captureMessage('Something went wrong');
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
```
9 changes: 9 additions & 0 deletions src/includes/configuration/before-breadcrumb-hint/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
12 changes: 12 additions & 0 deletions src/includes/configuration/before-send-fingerprint/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
11 changes: 11 additions & 0 deletions src/includes/configuration/before-send-hint/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
A `BiFunction<SentryEvent, Object, SentryEvent>` can be used to mutate, discard (return null), or return a completely new event.
marandaneto marked this conversation as resolved.
Show resolved Hide resolved

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

SentryEvent beforeSend(SentryEvent event, dynamic hint) {
return hint is MyHint ? null : event;
}

Sentry.init((options) => options.beforeSend = beforeSend);
```
13 changes: 13 additions & 0 deletions src/includes/configuration/before-send/flutter.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.
marandaneto marked this conversation as resolved.
Show resolved Hide resolved

```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);
```
16 changes: 8 additions & 8 deletions src/includes/configuration/config-intro/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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: '[email protected]',
environment: 'production',
)
);
void options(SentryOptions options) {
options.dsn = '___PUBLIC_DSN___';
options.release = '[email protected]';
options.environment = 'staging';
}

Sentry.init(options);
```
6 changes: 6 additions & 0 deletions src/includes/configuration/sample-rate/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```dart
import 'package:sentry/sentry.dart';

// Capture only 25% of events
Sentry.init((options) => options.sampleRate = 0.25);
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
```
11 changes: 11 additions & 0 deletions src/includes/configure-scope/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```dart
import 'package:sentry/sentry.dart';

void scope(Scope scope) {
scope.setTag('my-tag', 'my value');
final user = User(id: '42', email: '[email protected]');
scope.user = user;
}

Sentry.configureScope(scope);
```
5 changes: 5 additions & 0 deletions src/includes/getting-started-config/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.init((options) => options.dsn = '___PUBLIC_DSN___');
```
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: ^4.0.0
```
11 changes: 11 additions & 0 deletions src/includes/getting-started-verify/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```dart
// Throw an exception and capture it with the Sentry client:
try {
throw null;
} catch (error, stackTrace) {
Sentry.captureException(
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
exception: error,
stackTrace: stackTrace,
);
}
```
8 changes: 8 additions & 0 deletions src/includes/sensitive-data/set-tag/flutter.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/flutter.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,
));
```
18 changes: 8 additions & 10 deletions src/includes/set-context/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
8 changes: 2 additions & 6 deletions src/includes/set-environment/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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 = 'staging');
```
11 changes: 5 additions & 6 deletions src/includes/set-extra/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
```dart
import 'package:sentry/sentry.dart';
import 'package:sentry/sentry.dart';

final sentry = SentryClient(
environmentAttributes: const Event(
extra: { 'character.name': 'Mighty Fighter' }
)
);
Sentry.configureScope((scope) => scope.setExtra(
'character.name',
'Mighty Fighter',
));
```
12 changes: 12 additions & 0 deletions src/includes/set-fingerprint/basic/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
12 changes: 12 additions & 0 deletions src/includes/set-fingerprint/database-connection/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
24 changes: 24 additions & 0 deletions src/includes/set-fingerprint/rpc/flutter.mdx
Original file line number Diff line number Diff line change
@@ -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);
```
5 changes: 5 additions & 0 deletions src/includes/set-fingerprint/static/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.fingerprint = ['auth-error']);
```
5 changes: 5 additions & 0 deletions src/includes/set-level/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.level = SentryLevel.warning);
```
8 changes: 2 additions & 6 deletions src/includes/set-release/flutter.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
```dart
import 'package:sentry/sentry.dart';
import 'package:sentry/sentry.dart';

final sentry = SentryClient(
environmentAttributes: const Event(
release: '[email protected]'
)
);
Sentry.init((options) => options.release = '[email protected]');
```
5 changes: 5 additions & 0 deletions src/includes/set-tag/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.setTag('page.locale', 'pt-BR'));
```
5 changes: 5 additions & 0 deletions src/includes/set-user/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.user = User(email: '[email protected]'));
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
```
5 changes: 5 additions & 0 deletions src/includes/unset-user/flutter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```dart
import 'package:sentry/sentry.dart';

Sentry.configureScope((scope) => scope.user = null);
```
Loading