initial commit
This commit is contained in:
18
lib/objectbox.dart
Normal file
18
lib/objectbox.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
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-2'));
|
||||
return ObjectBox._create(store);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user