FLUTTER ECOSYSTEM

hive_generator

Extension for Hive. Automatically generates TypeAdapters to store any class.

Latest version
2.0.1
30-day downloads
175.8K
Likes
424
Pub points
100

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

Hive Generator is a code generation tool for Hive, a lightweight, fast, and efficient database for Flutter. It automatically generates TypeAdapters for any Dart class, enabling seamless serialization and storage without manual adapter implementation. By using annotations, developers can mark classes for code generation, reducing boilerplate and minimizing errors. The generated adapters handle complex data types, nested objects, and custom serializers efficiently. This package integrates smoothly with the Hive ecosystem and supports cross-platform apps on macOS, Windows, and Linux.

Use cases
  • Automatically generate TypeAdapters for model classes
  • Simplify data persistence in Flutter apps
  • Reduce boilerplate in Hive serialization
  • Support complex nested object storage
  • Enable type-safe data access with Hive
  • Streamline migration of existing models to Hive
Key features
  • Annotation-based code generation
  • Automatic TypeAdapter creation
  • Supports nested and custom types
  • Minimal setup with @HiveType annotation
  • Cross-platform compatibility
  • Integration with Hive's core library
Suitable for
  • Flutter developers using Hive for local storage
  • Projects requiring efficient and type-safe data persistence
  • Teams aiming to reduce manual serialization code
  • Apps with frequent model changes needing quick adapter updates
  • Developers prioritizing performance and simplicity
Considerations
  • Requires build_runner and hive_generator as dev dependencies
  • Generated code must be committed or regenerated on each build
  • Limited to classes annotated with @HiveType
  • Does not support dynamic or untyped fields
  • Build step required after modifying annotated classes
Supported platformsmacOSWindowsLinux

Install package

flutter pub add hive_generator

Categories

Related projects