diff --git a/hive_flutter/CHANGELOG.md b/hive_flutter/CHANGELOG.md index 3643f9a6..33f968e8 100644 --- a/hive_flutter/CHANGELOG.md +++ b/hive_flutter/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.0 + +- BREAKING: Register `ColorAdapter` and `TimeOfDayAdapter` in `Hive.initFlutter` + - MIGRATION: Remove external registration of `ColorAdapter` and `TimeOfDayAdapter` + ## 1.2.0 - The first release of hive_ce_flutter diff --git a/hive_flutter/lib/hive_flutter.dart b/hive_flutter/lib/hive_flutter.dart index 1ed5c575..af0c4d20 100644 --- a/hive_flutter/lib/hive_flutter.dart +++ b/hive_flutter/lib/hive_flutter.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:hive_ce/hive.dart'; +import 'package:hive_ce_flutter/adapters.dart'; import 'package:path/path.dart' if (dart.library.js_interop) 'src/stub/path.dart' as path_helper; import 'package:path_provider/path_provider.dart' diff --git a/hive_flutter/lib/src/hive_extensions.dart b/hive_flutter/lib/src/hive_extensions.dart index 7b97d3f4..02165c0b 100644 --- a/hive_flutter/lib/src/hive_extensions.dart +++ b/hive_flutter/lib/src/hive_extensions.dart @@ -5,6 +5,8 @@ extension HiveX on HiveInterface { /// Initializes Hive with the path from [getApplicationDocumentsDirectory]. /// /// You can provide a [subDir] where the boxes should be stored. + /// + /// Also registers the flutter type adapters Future initFlutter([ String? subDir, HiveStorageBackendPreference backendPreference = @@ -22,5 +24,8 @@ extension HiveX on HiveInterface { path, backendPreference: backendPreference, ); + + registerAdapter(ColorAdapter()); + registerAdapter(TimeOfDayAdapter()); } } diff --git a/hive_flutter/pubspec.yaml b/hive_flutter/pubspec.yaml index e4e25c6a..2c23d39d 100644 --- a/hive_flutter/pubspec.yaml +++ b/hive_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: hive_ce_flutter description: Extension for Hive. Makes it easier to use Hive in Flutter apps. -version: 1.2.0 +version: 2.0.0 homepage: https://github.com/IO-Design-Team/hive_ce/tree/main/hive_flutter documentation: https://docs.hivedb.dev/