Hive: Error: You have to provide a non-null typeId

Created on 17 Feb 2020  路  8Comments  路  Source: hivedb/hive

[SEVERE] hive_generator:hive_generator on lib/hive_db/scan_data.dart:
Error running TypeAdapterGenerator
You have to provide a non-null typeId.

I'm trying to follow the reso coder video. He had the same issue, but didn't explain the work around.

problem

Most helpful comment

Figured it out:

@HiveType(typeId: 0)

All 8 comments

Figured it out:

@HiveType(typeId: 0)

@sgehrman Yes, and you need to manually assign different type id's (integers) to your each one of your models

Please close this issue if it works now :+1:

I'm new to hive so this may be a user issue, but I'm running into the same issue.

Versions:
dependencies:
flutter:
sdk: flutter
flutter_facebook_login: ^3.0.0
http: ^0.12.0+4
hive: ^1.4.1+1
hive_flutter: ^0.3.0+2
path_provider: ^1.6.5

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3

dev_dependencies:
flutter_test:
sdk: flutter
hive_generator: ^0.7.0+2
build_runner: ^1.8.0

Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-US)

Figured it out:

@HiveType(typeId: 0)

Thanks, It worked <3

https://docs.hivedb.dev/#/custom-objects/generate_adapter

Update the documentation and be friendly to novices.

An exception should probably be thrown to the IDE, or intellisense should catch if an ID is not provided to the HiveType without having to go through a build attempt to catch this.

Figured it out:

@HiveType(typeId: 0)

Can be added to the docs?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SergeShkurko picture SergeShkurko  路  4Comments

aminjoharinia picture aminjoharinia  路  3Comments

ProfileID picture ProfileID  路  4Comments

rupamking1 picture rupamking1  路  3Comments

jamesdixon picture jamesdixon  路  3Comments