isar / isar/hive

Getting "Error : 'Pathrow' ins't type." on adding Hive.initFlutter();

Open
#853 4 comments 0 reactions 0 assignees View on GitHub
problem
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

**Steps to Reproduce**
When adding hive to my application, following the Hive Docs, when I add the `await Hive.initFlutter();` to my `Future main` method I am getting this error

```
: Error: 'Pathrow' isn't a type.
../…/src/hive_impl.dart:176
Pathrow HiveError('The box "$lowerCaseName" is already open '
^^^^^^^
: Error: Expected ';' after this.
../…/src/hive_impl.dart:176
Pathrow HiveError('The box "$lowerCaseName" is already open '

^^^^^^^^^
: Error: A non-null value must be returned since the return type 'BoxBase' doesn't allow null.
../…/src/hive_impl.dart:166
- 'BoxBase' is from 'package:hive/hive.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/hive-2.0.4/lib/hive.dart').
BoxBase _getBoxInternal(String name, [bool? lazy]) {
^
```

When I remove the hive dependency and the ` await Hive.initFlutter();` call I no longer get this error.

**Code sample**
My Main method code.

```
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'src/app.dart';

Future main() async {
await Hive.initFlutter();

runApp(
const MyApp(),
);
}.
```

**Version**
- Platform: iOS ( emulator and physical device ), Haven't tried on others.
- Flutter version: Dart 2.14.4
- hive: ^2.0.4
- hive_flutter: ^1.1.0
- hive_generator: ^1.1.1
- build_runner: ^2.1.5

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/hive_impl.dart around line 176 and reproduce the reported compiler errors using the listed Dart, Flutter, Hive, and hive_flutter versions with the shown main method. Determine why adding Hive.initFlutter() produces the Pathrow and return-type errors; done means the sample builds without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
databases, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.