Skip to content

Commit

Permalink
feat:Modify type of HiveField.defaultValue to dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
themisir committed Apr 19, 2021
1 parent 4446890 commit 49f9561
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions hive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.0.4

### Enhancements

- Adds default value support to hive_generator generated class adapters

# 2.0.3

### Fixes
Expand Down
12 changes: 5 additions & 7 deletions hive/lib/src/annotations/hive_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ class HiveField {
/// The index of this field.
final int index;

/// Set `true` to use this enum value as default value instead of null in
/// null-safety.
/// The default value of this field for class hive types.
///
/// This property currently only used for enum types. In future might be used
/// for other properties too. If the defaultValue is not provided the first
/// enum will be used as default value.
/// In enum hive types set `true` to use this enum value as default value
/// instead of null in null-safety.
///
/// ```dart
/// @HiveType(typeId: 1)
Expand All @@ -22,7 +20,7 @@ class HiveField {
/// pear
/// }
/// ```
final bool defaultValue;
final dynamic defaultValue;

const HiveField(this.index, {this.defaultValue = false});
const HiveField(this.index, {this.defaultValue});
}
2 changes: 1 addition & 1 deletion hive/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hive
description: Lightweight and blazing fast key-value database written in pure Dart. Strongly encrypted using AES-256.
version: 2.0.3
version: 2.0.4
homepage: https://github.com/hivedb/hive/tree/master/hive
documentation: https://docs.hivedb.dev/

Expand Down

0 comments on commit 49f9561

Please sign in to comment.