-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from IO-Design-Team/feature/generate-adapters
Add generator support for `GenerateAdapters` annotation
- Loading branch information
Showing
30 changed files
with
1,751 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:hive_ce/hive.dart'; | ||
|
||
part 'hive_adapters.g.dart'; | ||
|
||
@GenerateAdapters( | ||
[ | ||
AdapterSpec<ClassSpec1>(), | ||
AdapterSpec<ClassSpec2>(), | ||
AdapterSpec<EnumSpec>(), | ||
], | ||
firstTypeId: 50, | ||
) | ||
// This is for code generation | ||
// ignore: unused_element | ||
void _() {} | ||
|
||
class ClassSpec1 { | ||
final int value; | ||
final int value2; | ||
|
||
ClassSpec1(this.value, this.value2); | ||
} | ||
|
||
class ClassSpec2 { | ||
final String value; | ||
final String value2; | ||
|
||
ClassSpec2(this.value, this.value2); | ||
} | ||
|
||
enum EnumSpec { | ||
value1, | ||
value2; | ||
|
||
EnumSpec get getter => EnumSpec.value2; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Hive CE | ||
# Manual modifications may be necessary for certain migrations | ||
# Check in to version control | ||
nextTypeId: 53 | ||
types: | ||
ClassSpec1: | ||
typeId: 50 | ||
nextIndex: 2 | ||
fields: | ||
value: | ||
index: 0 | ||
value2: | ||
index: 1 | ||
ClassSpec2: | ||
typeId: 51 | ||
nextIndex: 2 | ||
fields: | ||
value: | ||
index: 0 | ||
value2: | ||
index: 1 | ||
EnumSpec: | ||
typeId: 52 | ||
nextIndex: 2 | ||
fields: | ||
value1: | ||
index: 0 | ||
value2: | ||
index: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
import 'package:hive_ce/hive.dart'; | ||
|
||
part 'named_import.g.dart'; | ||
|
||
@HiveType(typeId: 100) | ||
class NamedImportType {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
hive_generator/lib/src/enum_builder.dart → ...adapter_builder/enum_adapter_builder.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.