xiao_pet_tracker/lib/objectbox.dart
baldeau 12f8631c0f
Some checks failed
xiao_pet_tracker / semantic-pull-request (push) Failing after 0s
xiao_pet_tracker / build (push) Failing after 0s
xiao_pet_tracker / spell-check (push) Failing after 0s
update
2024-11-12 13:57:14 +01:00

19 lines
526 B
Dart

import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'objectbox.g.dart';
class ObjectBox {
late final Store store;
/// Initialization
ObjectBox._create(this.store);
/// Create an instance of ObjectBox to use throughout the app.
static Future<ObjectBox> create() async {
final docsDir = await getApplicationDocumentsDirectory();
final store =
await openStore(directory: p.join(docsDir.path, 'obx-pet-tracker'));
return ObjectBox._create(store);
}
}