Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ jobs:
env:
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
# TODO: Once 4.0.0 lands, change to 100
run: |
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
if (( $PERCENTAGE < 90 ))
if (( $PERCENTAGE < 100 ))
then
echo Score too low!
exit 1
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `package:sentry` and `package:sentry-flutter` changelog

## 4.0.0
## 4.0.0-alpha.1

- BREAKING CHANGE: Fixed context screenDensity is of type double #53
- BREAKING CHANGE: Fixed context screenDpi is of type int #58
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ We also run CI against the Flutter `stable` and `beta` channels so you should be

##### Versions

Versions `3.0.1` and higher support [Flutter][flutter] (mobile, web, desktop),
command-line/server Dart VM, and [AngularDart][angular_sentry].
Versions `3.0.1` and higher support `Flutter` (mobile, web, desktop),
command-line/server Dart VM, and `AngularDart`.

Versions below `3.0.1` are deprecated.

Expand Down Expand Up @@ -81,7 +81,7 @@ main() async {
##### Tips for catching errors

- Use a `try/catch` block, like in the example above.
- Create a `Zone` with an error handler, e.g. using [runZonedGuarded][run_zoned_guarded].
- Create a `Zone` with an error handler, e.g. using `runZonedGuarded`.

```dart
var sentry = SentryClient(dsn: "https://...");
Expand All @@ -102,7 +102,7 @@ main() async {
},
);
```
- For Flutter-specific errors (such as layout failures), use [FlutterError.onError][flutter_error]. For example:
- For Flutter-specific errors (such as layout failures), use `FlutterError.onError`. For example:

```dart
var sentry = SentryClient(dsn: "https://...");
Expand All @@ -129,4 +129,4 @@ main() async {
* [![Forum](https://img.shields.io/badge/forum-sentry-green.svg)](https://forum.sentry.io/c/sdks)
* [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
* [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](https://stackoverflow.com/questions/tagged/sentry)
* [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
* [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
1 change: 0 additions & 1 deletion dart/README.md

This file was deleted.

95 changes: 95 additions & 0 deletions dart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<p align="center">
<a href="https://sentry.io" target="_blank" align="center">
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
</a>
<br />
</p>

Sentry SDK for Dart and Flutter
===========

##### Usage

Sign up for a Sentry.io account and get a DSN at http://sentry.io.

In your Dart code, import `package:sentry/sentry.dart` and initialize the Sentry SDK using the DSN issued by Sentry.io:

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

Sentry.init((options) => options.dsn = 'https://[email protected]/add-your-dsn-here');
```

In an exception handler, call `captureException()`:

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

void main() async {
try {
aMethodThatMightFail();
} catch (exception, stackTrace) {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
}
}
```

##### Tips for catching errors

- Use a `try/catch` block, like in the example above.
- Create a `Zone` with an error handler, e.g. using `runZonedGuarded`.

```dart
import 'dart:async';

import 'package:flutter/material.dart';

import 'package:sentry/sentry.dart';

// Wrap your 'runApp(MyApp())' as follows:

Future<void> main() async {
runZonedGuarded<Future<void>>(() async {
runApp(MyApp());
}, (exception, stackTrace) async {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
});
}
```

- For Flutter-specific errors (such as layout failures), use `FlutterError.onError`. For example:

```dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:sentry/sentry.dart';

// Wrap your 'runApp(MyApp())' as follows:

Future<void> main() async {
FlutterError.onError = (FlutterErrorDetails details) async {
await Sentry.captureException(
details.exception,
stackTrace: details.stack,
);
};
}
```

- Use `Isolate.current.addErrorListener` to capture uncaught errors
in the root zone.

#### Resources

* [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/flutter/)
* [![Forum](https://img.shields.io/badge/forum-sentry-green.svg)](https://forum.sentry.io/c/sdks)
* [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
* [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](https://stackoverflow.com/questions/tagged/sentry)
* [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
2 changes: 1 addition & 1 deletion dart/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'event_example.dart';

/// Sends a test exception report to Sentry.io using this Dart client.
Future<void> main() async {
// Change the DSN
// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
const dsn =
'https://[email protected]/5428562';

Expand Down
2 changes: 1 addition & 1 deletion dart/example_web/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:sentry/sentry.dart';

import 'event.dart';

// Change the DSN
// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
const dsn =
'https://[email protected]/5428562';

Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library version;
import 'utils.dart';

/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '4.0.0';
const String sdkVersion = '4.0.0-alpha.1';

String get sdkName => isWeb ? _browserSdkName : _ioSdkName;

Expand Down
2 changes: 1 addition & 1 deletion dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sentry
version: 4.0.0
version: 4.0.0-alpha.1
description: >
A crash reporting library for Dart that sends crash reports to Sentry.io.
This library supports Dart Native, and Flutter for mobile, web, and desktop.
Expand Down
1 change: 1 addition & 0 deletions flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:universal_platform/universal_platform.dart';
const String _release =
String.fromEnvironment('SENTRY_RELEASE', defaultValue: 'unknown');

// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
const String exampleDsn =
'https://[email protected]/5428562';

Expand Down