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

Added Hive.ignoreTypeId method #397

Merged
merged 3 commits into from
Aug 3, 2020
Merged

Conversation

themisir
Copy link
Contributor

@themisir themisir commented Aug 2, 2020

The method adds support for ignoring not used types. It simply creates an empty IgnoredTypeAdapter for given type id.

Fixes #332

class IgnoredTypeAdapter<T> implements TypeAdapter<T> {
  IgnoredTypeAdapter([this._typeId = 0]);

  final int _typeId;

  @override
  T read(BinaryReader reader) {
    return null;
  }

  @override
  int get typeId => _typeId;

  @override
  void write(BinaryWriter writer, obj) {}
}

Example:

Hive.ignoreTypeId(2);

@themisir themisir changed the title Added Hive.ignoreTypeId method Added Hive.ignoreTypeId method (fixes #332) Aug 2, 2020
@themisir themisir changed the title Added Hive.ignoreTypeId method (fixes #332) Added Hive.ignoreTypeId method Aug 2, 2020
@themisir themisir added the enhancement New feature or request label Aug 3, 2020
@themisir themisir merged commit 7e12deb into master Aug 3, 2020
@themisir themisir deleted the feat/themisir/ignoreTypeId branch August 3, 2020 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HiveError: Cannot read, unknown typeId: 38. Did you forget to register an adapter?
1 participant