FLUTTER ECOSYSTEM

equatable

A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.

Latest version
2.0.8
30-day downloads
4M
Likes
3.6K
Pub points
160

Package Overview

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

Overview

Equatable is a Dart package that simplifies implementing value-based equality by automatically generating == and hashCode methods based on an object's properties. It eliminates the need to manually override these methods, reducing boilerplate code and minimizing errors. Ideal for models, states, and any class where equality depends on field values rather than identity. The package integrates seamlessly with Flutter and other Dart projects, enhancing code readability and maintainability.

Use cases
  • Comparing model objects in state management
  • Simplifying equality checks in Redux or Bloc patterns
  • Reducing boilerplate in data classes
  • Validating state changes in reactive UIs
  • Ensuring consistent hashing in collections
Key features
  • Automatic == and hashCode generation
  • Minimal boilerplate
  • Support for nested and complex types
  • Easy integration with Flutter state management
  • Extensible through mixins
Suitable for
  • Developers using Bloc or Redux
  • Teams prioritizing clean, maintainable code
  • Projects with frequent data comparison needs
  • Dart developers avoiding manual equality logic
  • Applications requiring predictable state updates
Considerations
  • May increase build time slightly
  • Not suitable for reference-based equality
  • Requires careful handling of null values
  • Limited customization for complex equality rules
  • Best used with immutable data structures
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add equatable

Categories

Source repository

Related projects

Rankings