Add material_ui support to hive_ce_flutter - #333
Conversation
# Conflicts: # hive_flutter/CHANGELOG.md # hive_flutter/lib/src/hive_extensions.dart
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only a minor test-coverage nit remains; no blocking issues were identified.
Review effort: Lite
Findings: 1
What changed in this PR
Adds material_ui support to hive_ce_flutter while preserving existing TimeOfDay compatibility and improving initialization path handling.
Changes:
- Adds
MaterialUiTimeOfDayAdapterand compatibility tests. - Adds
useMaterialUito both initialization APIs. - Refactors shared initialization and updates dependencies, Flutter constraints, and changelog.
| File | Summary |
|---|---|
hive_flutter/test/type_registry_extensions_test.dart |
Tests initialization path handling. |
hive_flutter/test/adapters/time_adapter_test.dart |
Tests adapter compatibility. |
hive_flutter/pubspec.yaml |
Updates dependencies and Flutter constraints. |
hive_flutter/lib/src/type_registry_extensions.dart |
Centralizes initialization and adapter registration. |
hive_flutter/lib/src/isolated_hive_extensions.dart |
Updates isolated Hive initialization. |
hive_flutter/lib/src/hive_extensions.dart |
Exposes the new initialization option. |
hive_flutter/lib/src/adapters/time_adapter.dart |
Adds the Material UI adapter. |
hive_flutter/CHANGELOG.md |
Documents the release changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #333 +/- ##
=======================================
Coverage 93.65% 93.65%
=======================================
Files 66 66
Lines 2663 2663
=======================================
Hits 2494 2494
Misses 169 169 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@Rexios80 Pardon my ignorance, but why are those 2 classes TimeOfDayAdapter and ColorAdapter in this database package ? To an outsider, this seems out of scope but i gather it's for convenience / historical reasons ? |
|
They were added well before Hive CE was a thing. I would say they aren't out of scope. These are commonly used Flutter types (especially Color) that developers would want adapters for. |

Summary
Closes #332
MaterialUiTimeOfDayAdapterfor theTimeOfDayclass frompackage:material_ui. It shares the binary format and default type id (201) withTimeOfDayAdapter, so existing data can be read as either class.TimeOfDayAdapterstill targetspackage:flutter/material.dart, so this is not a breaking change.useMaterialUiflag toHive.initFlutterandIsolatedHive.initFlutterto registerMaterialUiTimeOfDayAdapterinstead ofTimeOfDayAdapter(defaultfalse).initFlutterlogic into an internalinitFlutterCommon, which also givesIsolatedHive.initFlutterthe absolute path handling from Rename subDir to dir in initFlutter, treat as relative or absolute #293.material_ui: ^1.0.0dependency and raises the minimum Flutter version to 3.44.0, whichmaterial_ui1.0.0 requires. Bumps the version to 2.4.0.Test plan
dart format . --set-exit-if-changeddart analyze --fatal-infosflutter test, including new tests that data written by eitherTimeOfDayadapter reads back correctly with the other, and tests for relative and absoluteinitFlutterpathsflutter build webfor the example appmaterial_ui1.0.0 andhive_ce2.16.0 (the minimum constraints)