From 4d62d574e153b62455f2a97c34ce63b6ba56e094 Mon Sep 17 00:00:00 2001 From: Aswin Mohan Date: Fri, 2 Aug 2019 15:35:33 +0530 Subject: [PATCH] Update with info on build command (#9) Update the docs with the build command and add missing required dependency --- docs/generate_adapter.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generate_adapter.md b/docs/generate_adapter.md index 5da49c3e6..cd9213dfd 100644 --- a/docs/generate_adapter.md +++ b/docs/generate_adapter.md @@ -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 @@ -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. \ No newline at end of file +- Changing the type of a field is not supported. You should create a new one instead.