Sentry integration for

package build pub likes popularity pub points
sentry_file build pub package likes popularity pub points


  • Sign up for a account and get a DSN at

  • Follow the installing instructions on

  • Initialize the Sentry SDK using the DSN issued by

  • Set Up Performance.

import 'package:sentry/sentry.dart';
import 'package:sentry_file/sentry_file.dart';
import 'dart:io';

Future<void> main() async {
  // or SentryFlutter.init
  await Sentry.init(
    (options) {
      options.dsn = '';
      // To set a uniform sample rate
      options.tracesSampleRate = 1.0;
    appRunner: runApp, // Init your App.

Future<void> runApp() async {
  final file = File('my_file.txt');
  // Call the Sentry extension method to wrap up the File
  final sentryFile = file.sentryTrace();

  // Start a transaction if there's no active transaction
  final transaction = Sentry.startTransaction(
    bindToScope: true,

  // create the File
  await sentryFile.create();
  // Write some content
  await sentryFile.writeAsString('Hello World');
  // Read the content
  final text = await sentryFile.readAsString();


  // Delete the file
  await sentryFile.delete();

  // Finish the transaction
  await transaction.finish(status: SpanStatus.ok());

  await Sentry.close();


  • Documentation
  • Forum
  • Discord
  • Stack Overflow
  • Twitter Follow