storeBox<T> method
Opens a box and returns an open box
Implementation
Future<Box<T>> storeBox<T>(String boxKey) async {
// if(openBoxes[boxKey] == null){
// //Open the box
// Box<T> box = await Hive.openBox<T>(boxKey);
// openBoxes[boxKey] = box;
// return box;
// }
try{
return openBoxes[boxKey] as Box<T>;
}catch(e){
//Open the box
Box<T> box = await Hive.openBox<T>(boxKey);
openBoxes[boxKey] = box;
return box;
}
}