sentry 3.0.1 copy "sentry: ^3.0.1" to clipboard
sentry: ^3.0.1 copied to clipboard

outdated

A crash reporting library for for Dart that sends crash reports to Sentry.io. This library supports Dart VM, and Flutter for mobile, web, and desktop.

example/main.dart

// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:sentry/sentry.dart';

/// Sends a test exception report to Sentry.io using this Dart client.
Future<Null> main(List<String> rawArgs) async {
  if (rawArgs.length != 1) {
    stderr.writeln(
        'Expected exactly one argument, which is the DSN issued by Sentry.io to your project.');
    exit(1);
  }

  final String dsn = rawArgs.single;
  final SentryClient client = SentryClient(dsn: dsn);

  try {
    await foo();
  } catch (error, stackTrace) {
    print('Reporting the following stack trace: ');
    print(stackTrace);
    final SentryResponse response = await client.captureException(
      exception: error,
      stackTrace: stackTrace,
    );

    if (response.isSuccessful) {
      print('SUCCESS\nid: ${response.eventId}');
    } else {
      print('FAILURE: ${response.error}');
    }
  } finally {
    await client.close();
  }
}

Future<Null> foo() async {
  await bar();
}

Future<Null> bar() async {
  await baz();
}

Future<Null> baz() async {
  throw StateError('This is a test error');
}
498
likes
0
pub points
96%
popularity

Publisher

verified publishersentry.io

A crash reporting library for for Dart that sends crash reports to Sentry.io. This library supports Dart VM, and Flutter for mobile, web, and desktop.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, meta, pedantic, stack_trace, usage

More

Packages that depend on sentry