Skip to content

Commit

Permalink
Add initializer list example
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Sep 3, 2024
1 parent e826d6c commit 45f96ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion hive_generator/example/lib/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ class IterableClass {

@HiveType(typeId: 6)
class ConstructorDefaults {
ConstructorDefaults({this.a = 42, this.b = '42', this.c = true});
ConstructorDefaults({
this.a = 42,
this.b = '42',
this.c = true,
DateTime? d,
}) : d = d ?? DateTime.now();

@HiveField(0)
final int a;
Expand All @@ -91,6 +96,9 @@ class ConstructorDefaults {

@HiveField(2)
final bool c;

@HiveField(3)
final DateTime d;
}

@HiveType(typeId: 7)
Expand Down
7 changes: 5 additions & 2 deletions hive_generator/example/lib/types.g.dart

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

0 comments on commit 45f96ff

Please sign in to comment.