Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method 'initFlutter' isn't defined for the class 'HiveInterface' #239

Closed
Rayv1 opened this issue Feb 24, 2020 · 8 comments
Closed

The method 'initFlutter' isn't defined for the class 'HiveInterface' #239

Rayv1 opened this issue Feb 24, 2020 · 8 comments
Labels
question Further information is requested

Comments

@Rayv1
Copy link

Rayv1 commented Feb 24, 2020

Hi,

iam trying to init Hive in Main Function with Hive.initFlutter(); as described in your documents. Unfortunately my VS Code shows "The method 'initFlutter' isn't defined for the class 'HiveInterface'."

Maybe i missed a additional step to make it work.

  • Platform: Android, Windows
  • Flutter version: 1.14.6
    hive: ^1.4.1
    hive_flutter: ^0.3.0+2
    dev_dependencies:
    hive_generator: ^0.7.0+2
    build_runner: ^1.7.4
@Rayv1 Rayv1 added the question Further information is requested label Feb 24, 2020
@owczaro
Copy link

owczaro commented Feb 24, 2020

Hi @Rayv1 ,
have you tried to import package:hive_flutter/hive_flutter.dart?

@Rayv1 Rayv1 closed this as completed Feb 26, 2020
@Rayv1
Copy link
Author

Rayv1 commented Feb 26, 2020

yep, just forgot to import the second package

@sghaleb1
Copy link

i am getting the same issue, I have imported the hive_flutter package.

hive: ^1.4.1+1
hive_flutter: ^0.3.0+2

@lordvcs
Copy link

lordvcs commented Aug 28, 2020

You need to import both hive and hive_flutter.

@JanuszHain
Copy link

Just add import 'package:hive_flutter/hive_flutter.dart';

Little explanation: initFlutter() is extension and Android Studio currently doesn't support importing extensions for Dart, that's why we have to setup import manually

@XinyueZ
Copy link

XinyueZ commented Dec 6, 2020

IDE issue

@berkeugur
Copy link

You must addimport 'package:hive_flutter/hive_flutter.dart';

@reshnu
Copy link

reshnu commented Jul 24, 2021

you should add hive_flutter in pubspec.yaml and import 'package:hive_flutter/hive_flutter.dart';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants