openBox method

Future<List<String>> openBox(
  1. String boxName
)

打开一个盒子,并获取所有键

Implementation

Future<List<String>> openBox(String boxName) async {
  final exists = await Hive.boxExists(boxName);
  if (!exists) {
    ///提示没有这个盒子
    return [];
  }
  final box = await Hive.openBox(boxName);
  final keys = box.keys;
  return keys.map((e) => e.toString()).toList();
}