diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index f12f4ecc90..1aad8a7064 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a3399e38b8..eeae14eaa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 5c792aaf8e..d56bb3acba 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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://..."); @@ -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://..."); @@ -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) \ No newline at end of file diff --git a/dart/README.md b/dart/README.md deleted file mode 120000 index 32d46ee883..0000000000 --- a/dart/README.md +++ /dev/null @@ -1 +0,0 @@ -../README.md \ No newline at end of file diff --git a/dart/README.md b/dart/README.md new file mode 100644 index 0000000000..f1faa6003b --- /dev/null +++ b/dart/README.md @@ -0,0 +1,95 @@ +

+ + + +
+

+ +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://example@sentry.io/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 main() async { + runZonedGuarded>(() 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 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) diff --git a/dart/example/main.dart b/dart/example/main.dart index 1bade23828..aabcf2ea54 100644 --- a/dart/example/main.dart +++ b/dart/example/main.dart @@ -10,7 +10,7 @@ import 'event_example.dart'; /// Sends a test exception report to Sentry.io using this Dart client. Future 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://cb0fad6f5d4e42ebb9c956cb0463edc9@o447951.ingest.sentry.io/5428562'; diff --git a/dart/example_web/web/main.dart b/dart/example_web/web/main.dart index 5377e5f448..1d25121f17 100644 --- a/dart/example_web/web/main.dart +++ b/dart/example_web/web/main.dart @@ -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://cb0fad6f5d4e42ebb9c956cb0463edc9@o447951.ingest.sentry.io/5428562'; diff --git a/dart/lib/src/version.dart b/dart/lib/src/version.dart index 820cd11bdf..487efeaa8a 100644 --- a/dart/lib/src/version.dart +++ b/dart/lib/src/version.dart @@ -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; diff --git a/dart/pubspec.yaml b/dart/pubspec.yaml index b1bb5988e6..0060ea021b 100644 --- a/dart/pubspec.yaml +++ b/dart/pubspec.yaml @@ -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. diff --git a/flutter/example/lib/main.dart b/flutter/example/lib/main.dart index 7c9dc8f024..c0048ba2bf 100644 --- a/flutter/example/lib/main.dart +++ b/flutter/example/lib/main.dart @@ -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://cb0fad6f5d4e42ebb9c956cb0463edc9@o447951.ingest.sentry.io/5428562';