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

Update generate_adapter.md #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions custom-objects/generate_adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

The [hive\_generator](https://pub.dev/packages/hive_generator) package can automatically generate `TypeAdapter`s for almost any class.

1. To generate a `TypeAdapter` for a class, annotate it with `@HiveType` and provide a `typeId` (between 0 and 223)
2. Annotate all fields which should be stored with `@HiveField`
3. Run build task `flutter packages pub run build_runner build`
4. [Register](custom-objects/type_adapters.md) the generated adapter
1. Make sure [hive_generator](https://pub.dev/packages/hive_generator) is added as a dev dependency to your project.
2. To generate a `TypeAdapter` for a class, annotate it with `@HiveType` and provide a `typeId` (between 0 and 223)
3. Annotate all fields which should be stored with `@HiveField`
4. Run build task `flutter packages pub run build_runner build`
5. [Register](custom-objects/type_adapters.md) the generated adapter

### Example

Expand Down