You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
890 B

import 'package:local_db_core/boxes/box_list/level_box/level_box.dart';
import 'package:path_provider/path_provider.dart';
import 'package:repositories/level_box_domain/adapter/level_model_adapter.dart';
import 'package:repositories/level_box_domain/repository/level_box_repository.dart';
import 'package:types/level_data/interface/level_box_repository_impl.dart';
import 'package:hive_flutter/hive_flutter.dart';
class Initializer {
Initializer.privateConstructor();
final LevelBoxRepository _repository = LevelBoxRepositoryImpl(levelBox: LevelBox());
static final Initializer instance = Initializer.privateConstructor();
factory Initializer() {
return instance;
}
Future<void> initialHive() async {
final dir = await getApplicationDocumentsDirectory();
Hive.init(dir.path);
Hive.registerAdapter(LevelModelAdapter());
await _repository.openBox();
}
}