0

I'm using Hive for saving local data.

To use hive, I'm suppose to run "Hive.initFlutter()" in main().

When I run the app, the screen stays in the black screen

because await _platform.getApplicationDocumentsPath(); from path_provider package doesn't work in Hive.initFlutter().

I get the error message like below.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
<asynchronous suspension>
#1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:120:24)
<asynchronous suspension>
#2      HiveX.initFlutter (package:hive_flutter/src/hive_extensions.dart:12:18)
<asynchronous suspension>
#3      main (package:myapp/main.dart:133:3)
<asynchronous suspension> 

In some posts, it says 'flutter clean and restart the app instead of hot reload will fix the problem' but it doesn't fix anything.

If someone dealt with this issue, plz share.

Dependency version info related to the error is

dependencies:
  path_provider: ^2.0.14
  hive: ^2.2.3
  hive_flutter: ^1.1.0

Flutter/Dart Version information enter image description here

0 Answers0