Skip to content

Upgrading hive_generator 0.8 to 1

Breaking0.8.2 → 1.1.3Breaking4New3Changed3Fixed3Other3

BreakingUpgrade verdict

4 breaking changes.

  • You can no longer attach a type adapter to just one box; adapters must be registered globally.
  • Deleting an object that was never saved now raises an error instead of silently doing nothing.
  • Code that expected a list back from addAll() now gets a more general iterable, so list-specific operations may need adjusting.
  • Passing an index that does not exist now fails instead of being silently allowed.
Top 3 of 4 that need code or config changes

Dart SDK requirement changed in 1.0.1: >=2.6.0 <3.0.0 → >=2.12.0 <3.0.0.

Adds source_helper ^1.1.0.

Drops dartx.

Moves analyzer >=0.36.0 <2.0.0 → >=1.0.0 <5.0.0, build ^1.1.6 → ^2.0.0, hive >=1.3.0 <2.0.0 → ^2.0.4, source_gen >=0.9.4+4 <2.0.0 → ^1.0.0. Your build may pick other versions.

Breaking4
Removes the option to register TypeAdapters for a specific box, such as box.registerTypeAdapter().
TypeAdaptersregisterTypeAdapter()
object.delete() now throws an exception if the object is not stored in a box.
object.delete()
Changes the return type of addAll() from List<int> to Iterable<int>.
addAll()
getAt(), putAt(), deleteAt() and keyAt() no longer allow indices out of range.
getAt()putAt()deleteAt()keyAt()