错误:Unhandled Exception: HiveError: You need to initialize Hive or provide a path to store the box.
基本上我的依赖项中有这些,所以一切都应该很好。
hive: ^1.4.4+1
hive_flutter: ^0.3.1
path_provider: ^1.6.27
我也有import 'package:hive/hive.dart';
和
import 'package:path_provider/path_provider.dart';
在文件中
所以我只有
void doSomething() async {
final documentDirectory = await getApplicationDocumentsDirectory();
Hive.init(documentDirectory.path);
}
叫。
我不明白。我想我做的一切都是正确的。让我知道您是否需要其他东西。