sentry_sqflite 8.12.0-beta.2 sentry_sqflite: ^8.12.0-beta.2 copied to clipboard
An integration which adds support for performance tracing for the sqflite package.
Sentry integration for sqflite
package #
package | build | pub | likes | popularity | pub points |
---|---|---|---|---|---|
sentry_sqflite |
Integration for the sqflite
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:sentry_flutter/sentry_flutter.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sentry_sqflite/sentry_sqflite.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> insertProducts() async {
databaseFactory = SentrySqfliteDatabaseFactory();
final db = await openDatabase(inMemoryDatabasePath);
await db.execute('''
CREATE TABLE Product (
id INTEGER PRIMARY KEY,
title TEXT
)
''');
await db.insert('Product', <String, Object?>{'title': 'Product 1'});
await db.insert('Product', <String, Object?>{'title': 'Product 2'});
final result = await db.query('Product');
print(result);
await db.close();
}