Skip to content

Commit 49f9561

Browse files
committed
feat:Modify type of HiveField.defaultValue to dynamic
1 parent 4446890 commit 49f9561

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

hive/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.0.4
2+
3+
### Enhancements
4+
5+
- Adds default value support to hive_generator generated class adapters
6+
17
# 2.0.3
28

39
### Fixes

hive/lib/src/annotations/hive_field.dart

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ class HiveField {
55
/// The index of this field.
66
final int index;
77

8-
/// Set `true` to use this enum value as default value instead of null in
9-
/// null-safety.
8+
/// The default value of this field for class hive types.
109
///
11-
/// This property currently only used for enum types. In future might be used
12-
/// for other properties too. If the defaultValue is not provided the first
13-
/// enum will be used as default value.
10+
/// In enum hive types set `true` to use this enum value as default value
11+
/// instead of null in null-safety.
1412
///
1513
/// ```dart
1614
/// @HiveType(typeId: 1)
@@ -22,7 +20,7 @@ class HiveField {
2220
/// pear
2321
/// }
2422
/// ```
25-
final bool defaultValue;
23+
final dynamic defaultValue;
2624

27-
const HiveField(this.index, {this.defaultValue = false});
25+
const HiveField(this.index, {this.defaultValue});
2826
}

hive/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: hive
22
description: Lightweight and blazing fast key-value database written in pure Dart. Strongly encrypted using AES-256.
3-
version: 2.0.3
3+
version: 2.0.4
44
homepage: https://github.com/hivedb/hive/tree/master/hive
55
documentation: https://docs.hivedb.dev/
66

0 commit comments

Comments
 (0)