sentry_isar 8.11.0-beta.1 sentry_isar: ^8.11.0-beta.1 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 |
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());
}