barcode_scanner/lib/backend/objectbox/objectbox_manager.dart
mandreshope 61047f266d chore: Renames project to e_scan
Performs a comprehensive project rename from 'barcode_scanner' to 'e_scan' (or 'eScan' for user-facing labels). This update spans all relevant files, including:

- Application IDs and bundle identifiers for Android, iOS, macOS, and Linux.
- VS Code launch configurations.
- Dart package import paths.
- Project names and titles in `pubspec.yaml`, `README.md`, and platform-specific configurations (e.g., CMakeLists, Info.plist, AndroidManifest).
2025-07-30 09:19:44 +03:00

36 lines
1.0 KiB
Dart

import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:e_scan/backend/objectbox/objectbox.g.dart';
export 'package:e_scan/backend/objectbox/objectbox.g.dart';
late ObjectboxManager objectboxManager;
class ObjectboxManager {
ObjectboxManager._create(this.store);
/// The Store of this app.
late final Store store;
/// Create an instance of ObjectBox to use throughout the app.
static Future<ObjectboxManager> create() async {
Directory directory;
if (Platform.isIOS) {
directory = await getLibraryDirectory();
} else {
directory = await getApplicationSupportDirectory();
}
// Future<Store> openStore() {...} is defined in the generated objectbox.g.dart
final store = await openStore(
directory: p.join(directory.path, "objectbox_db"),
);
return ObjectboxManager._create(store);
}
/// Call it before `runApp()` in main.dart
static Future init() async {
objectboxManager = await ObjectboxManager.create();
}
}