tree: 35d57d42167afb3c7df2cb5824d293c222cb009b [path history] [tgz]
  3. analysis_options.yaml
  4. lib/
  5. pubspec.yaml
  6. test/


A library to facilitate reporting analytics and crash reports.


This library is designed to allow all Dart SDK tools to easily send analytics information and crash reports. The tools share a common setting to configure sending analytics data. To use this library for a specific tool:

import 'package:telemetry/telemetry.dart';
import 'package:usage/usage.dart';

main() async {
  final String myAppTrackingID = ...;
  final String myAppName = ...;

  Analytics analytics = createAnalyticsInstance(myAppTrackingID, myAppName);
  await analytics.waitForLastPing();

The analytics object reads from the correct user configuration file automatically without any additional configuration. Analytics will not be sent if the user has opted-out.

Crash reporting

To use the crash reporting functionality, import crash_reporting.dart, and create a new CrashReportSender instance:

import 'package:telemetry/crash_reporting.dart';

main() {
  Analytics analytics = ...;
  CrashReportSender sender = new CrashReportSender(analytics);
  try {
  } catch (e, st) {
    sender.sendReport(e, st);

Crash reports will only be sent if the cooresponding [Analytics] object is configured to send analytics.