Skip to content

Commit

Permalink
docs: added comments on generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
kishormainali committed Nov 28, 2023
1 parent 03e37d4 commit 303a5b7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.2
- added comments on generated code

# 1.0.1
- remove duplicate imports from generated code

Expand Down
6 changes: 6 additions & 0 deletions example/lib/src/core/register_adapters.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions lib/src/type_register_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,22 @@ class TypeRegisterBuilder implements Builder {

var library = Library(
(builder) => builder
..comments.addAll([
'GENERATED CODE - DO NOT MODIFY BY HAND',
'ignore_for_file: lines_longer_than_80_chars',
])
..directives.addAll(imports)
..body.addAll(
[
const Code('\n'),
const Code(
'//*****************************************************************************'),
const Code('\n'),
const Code('// Type Adapters'),
const Code('\n'),
const Code(
'//*****************************************************************************'),
const Code('\n'),
const Code('void registerAdapters(){'),
...files
.map((e) => Code('Hive.registerAdapter(${e.adapterName}());')),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: type_register
description: Generator which generates method named registerAdapters with all the hive adapters for the types annotated with @HiveType.
version: 1.0.1
version: 1.0.2
topics:
- type-register-generator
- dart
Expand Down

0 comments on commit 303a5b7

Please sign in to comment.