hive_flutter_repository 1.0.3 hive_flutter_repository: ^1.0.3 copied to clipboard
A DatabaseAdapter for the hive database as used by the database_repository package optimized for use with flutter
void main() {
// Path will resolve to "${getApplicationDocumentsDirectory()}/hive"
// See path_provider on documentation about `getApplicationDocumentsDirectory`
final pathWhereHiveShouldLive = 'hive'
final myDatabaseAdapter = HiveFlutterDatabaseAdapter(path: pathWhereHiveShouldLive);
// Register a Database Adapter that you want to use.
DatabaseAdapterRegistry.register(myDatabaseAdapter);
final repository = DatabaseRepository.fromRegistry(serializer: mySerializer, name: 'hive');
// Now use some methods such as create() etc.
}