Can't use Hive on Linux desktop
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
I can't init Flutter/Hive on desktop on linux. `getApplicationDocumentsDirectory` get called and is not supported.
`[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)`
This is the code where I init Hive:
```
void main() async {
await Hive.initFlutter("/my_folder_path");
runApp(MyApp());
}
```
**Version**
flutter doctor:
[✓] Flutter (Channel dev, 1.26.0-1.0.pre, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.52.1)
[✓] Connected device (1 available)
As a workaround,
```
WidgetsFlutterBinding.ensureInitialized();
Hive.init("/my_folder_path");
```
Works
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.