sentry_hive 8.0.0-beta.2 copy "sentry_hive: ^8.0.0-beta.2" to clipboard
sentry_hive: ^8.0.0-beta.2 copied to clipboard

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


Sentry integration for hive package #

package build pub likes popularity pub points
sentry_hive build pub package likes popularity pub points

Integration for the hive 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/sentry.dart';
import 'package:hive/hive.dart';
import 'package:sentry_hive/sentry_hive.dart';
import 'package:path_provider/path_provider.dart';

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

Future<void> insertUser() async {
  // Use [SentryHive] where you would use [Hive]
  final appDir = await getApplicationDocumentsDirectory();
  SentryHive
    ..init(appDir.path)
    ..registerAdapter(PersonAdapter());

  var box = await SentryHive.openBox('testBox');

  var person = Person(
    name: 'Dave',
    age: 22,
  );

  await box.put('dave', person);

  print(box.get('dave')); // Dave: 22
}

@HiveType(typeId: 1)
class Person {
  Person({required this.name, required this.age});

  @HiveField(0)
  String name;

  @HiveField(1)
  int age;

  @override
  String toString() {
    return '$name: $age';
  }
}

Resources

  • Flutter docs
  • Dart docs
  • Discussions
  • Discord Chat
  • Stack Overflow
  • Twitter Follow
1
likes
140
pub points
79%
popularity

Publisher

verified publishersentry.io

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

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (LICENSE)

Dependencies

hive, meta, sentry

More

Packages that depend on sentry_hive