sentry_isar 8.11.2 copy "sentry_isar: ^8.11.2" to clipboard
sentry_isar: ^8.11.2 copied to clipboard

An integration which adds support for performance tracing for the isar package.


Sentry integration for isar package #

package build pub likes popularity pub points
sentry_isar build pub package likes popularity pub points

Integration for the isar package.

Usage

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

  • Follow the installing instructions on pub.dev.

  • Initialize the Sentry SDK using the DSN issued by Sentry.io.

  • Call...

import 'package:path_provider/path_provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_isar/sentry_isar.dart';

import 'user.dart';

Future<void> main() async {
  await SentryFlutter.init(
    (options) {
      options.dsn = 'https://example@sentry.io/add-your-dsn-here';
      options.tracesSampleRate = 1.0;
    },
    // Init your App.
    appRunner: () => runApp(MyApp()),
  );
}

Future<void> runApp() async {
  final tr = Sentry.startTransaction(
    'isarTest',
    'db',
    bindToScope: true,
  );

  final dir = await getApplicationDocumentsDirectory();

  final isar = await SentryIsar.open(
    [UserSchema],
    directory: dir.path,
  );

  final newUser = User()
    ..name = 'Joe Dirt'
    ..age = 36;

  await isar.writeTxn(() async {
    await isar.users.put(newUser); // insert & update
  });

  final existingUser = await isar.users.get(newUser.id); // get

  await isar.writeTxn(() async {
    await isar.users.delete(existingUser!.id); // delete
  });

  await tr.finish(status: const SpanStatus.ok());
}

Resources

  • Flutter docs
  • Dart docs
  • Discussions
  • Discord Chat
  • Stack Overflow
  • Twitter Follow
1
likes
160
points
1.57k
downloads

Publisher

verified publishersentry.io

Weekly Downloads

An integration which adds support for performance tracing for the isar package.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

isar, isar_flutter_libs, meta, path, sentry

More

Packages that depend on sentry_isar