Skip to content

Commit

Permalink
Update with info on build command (#9)
Browse files Browse the repository at this point in the history
Update the docs with  the build command and add missing required dependency
  • Loading branch information
aswinmohanme authored and simc committed Aug 2, 2019
1 parent e33cbf3 commit 4d62d57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/generate_adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

The [hive_generator](https://pub.dev/packages/hive_generator) automatically generates `TypeAdapter`s for almost any class.

1. Add `hive_generator` to your `pubspec.yaml` (as `dev_dependency`)
1. Add `hive_generator` and `build_runner` to your `pubspec.yaml` (as `dev_dependency`)
2. To generate a `TypeAdapter` for a class, annotate it with `@HiveType`
3. Annotate all fileds which should be stored with `@HiveField`
4. Run build task
4. Run build task `flutter packages pub run build_runner build`
5. [Register](register_adapter.md) adapter

### Example
Expand Down Expand Up @@ -43,4 +43,4 @@ If an existing class needs to be changed – for example, you'd like the class t
- If you add new fields, any objects written by the "old" adapter can still be read by the new adapter. These fields will just be ignored. Similarly, objects written by your new code can be read by your old code: the new field will be ignored when parsing.
- Fields can be renamed and even changed from public to private or vice versa as long as the field number stays the same.
- Fields can be removed, as long as the field number is not used again in your updated class.
- Changing the type of a field is not supported. You should create a new one instead.
- Changing the type of a field is not supported. You should create a new one instead.

0 comments on commit 4d62d57

Please sign in to comment.