From 49f9561100c1cec80c6301fc51e03da2795f72ca Mon Sep 17 00:00:00 2001 From: Misir Jafarov Date: Tue, 20 Apr 2021 00:54:19 +0400 Subject: [PATCH] feat:Modify type of HiveField.defaultValue to dynamic --- hive/CHANGELOG.md | 6 ++++++ hive/lib/src/annotations/hive_field.dart | 12 +++++------- hive/pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hive/CHANGELOG.md b/hive/CHANGELOG.md index b823d2b43..eb2ba655f 100644 --- a/hive/CHANGELOG.md +++ b/hive/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2.0.4 + +### Enhancements + +- Adds default value support to hive_generator generated class adapters + # 2.0.3 ### Fixes diff --git a/hive/lib/src/annotations/hive_field.dart b/hive/lib/src/annotations/hive_field.dart index f49498c0e..9eba2119c 100644 --- a/hive/lib/src/annotations/hive_field.dart +++ b/hive/lib/src/annotations/hive_field.dart @@ -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) @@ -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}); } diff --git a/hive/pubspec.yaml b/hive/pubspec.yaml index 6f5fef145..b456aa140 100644 --- a/hive/pubspec.yaml +++ b/hive/pubspec.yaml @@ -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/