CINXE.COM
equatable | Dart package
<!DOCTYPE html> <html lang="en-us"><head><script src="https://www.googletagmanager.com/gtm.js?id=GTM-MX6DBN9" async="async"></script><script src="/static/hash-6oi64i7a/js/gtm.js" async="async"></script><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@dart_lang"/><meta name="twitter:description" content="A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode."/><meta name="twitter:image" content="https://pub.dev/static/hash-6oi64i7a/img/pub-dev-icon-cover-image.png"/><meta property="og:type" content="website"/><meta property="og:site_name" content="Dart packages"/><meta property="og:title" content="equatable | Dart package"/><meta property="og:description" content="A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode."/><meta property="og:image" content="https://pub.dev/static/hash-6oi64i7a/img/pub-dev-icon-cover-image.png"/><meta property="og:url" content="https://pub.dev/packages/equatable"/><title>equatable | Dart package</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Display:wght@400&family=Google+Sans+Text:wght@400;500;700&family=Google+Sans+Mono:wght@400;700&display=swap"/><link rel="shortcut icon" href="/favicon.ico?hash=nk4nss8c7444fg0chird9erqef2vkhb8"/><meta rel="apple-touch-icon" href="/static/hash-6oi64i7a/img/apple-touch-icon.png"/><meta rel="apple-touch-icon-precomposed" href="/static/hash-6oi64i7a/img/apple-touch-icon.png"/><link rel="stylesheet" href="https://www.gstatic.com/glue/v25_0/ccb.min.css"/><link rel="search" type="application/opensearchdescription+xml" title="Dart packages" href="/osd.xml"/><link rel="canonical" href="https://pub.dev/packages/equatable"/><meta name="description" content="A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode."/><link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom"/><link rel="stylesheet" type="text/css" href="/static/hash-6oi64i7a/material/bundle/styles.css"/><link rel="stylesheet" type="text/css" href="/static/hash-6oi64i7a/css/style.css"/><script src="/static/hash-6oi64i7a/material/bundle/script.min.js" defer="defer"></script><script src="/static/hash-6oi64i7a/js/script.dart.js" defer="defer"></script><script src="https://www.gstatic.com/brandstudio/kato/cookie_choice_component/cookie_consent_bar.v3.js" defer="defer" data-autoload-cookie-consent-bar="true"></script><meta name="pub-page-data" content="eyJwa2dEYXRhIjp7InBhY2thZ2UiOiJlcXVhdGFibGUiLCJ2ZXJzaW9uIjoiMi4wLjciLCJsaWtlcyI6MzQxNCwicHVibGlzaGVySWQiOiJmbHV0dGVyY29tbXVuaXR5LmRldiIsImlzRGlzY29udGludWVkIjpmYWxzZSwiaXNMYXRlc3QiOnRydWV9LCJzZXNzaW9uQXdhcmUiOmZhbHNlfQ=="/><link rel="preload" href="/static/hash-6oi64i7a/highlight/highlight-with-init.js" as="script"/></head><body class="light-theme"><script src="/static/hash-6oi64i7a/js/dark-init.js"></script><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MX6DBN9" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div class="site-header"><button class="hamburger" aria-label="menu toggle"></button><a class="logo" href="/" aria-label="Go to the landing page of pub.dev"><img class="site-logo" src="/static/hash-6oi64i7a/img/pub-dev-logo.svg" alt="" width="140" height="30" role="presentation"/></a><div class="site-header-space"></div><div class="site-header-mask"></div><div class="site-header-search"><form action="/packages" method="GET"><input class="site-header-search-input" name="q" placeholder="New search..." autocomplete="on" title="Search"/></form></div><nav class="site-header-nav scroll-container"><div class="nav-login-container"><button id="-account-login" class="nav-main-button link">Sign in</button></div><div class="nav-container nav-help-container hoverable"><button class="nav-main-button">Help</button><div class="nav-hover-popup"><div class="nav-table-columns"><div class="nav-table-column"><h3>pub.dev</h3><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div><div class="nav-table-column"><h3>Flutter</h3><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div><div class="nav-table-column"><h3>Dart</h3><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">pub.dev <img class="foldable-icon" src="/static/hash-6oi64i7a/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Flutter <img class="foldable-icon" src="/static/hash-6oi64i7a/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Dart <img class="foldable-icon" src="/static/hash-6oi64i7a/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></nav><button class="-pub-theme-toggle" aria-label="light/dark theme toggle"></button></div><div id="banner-container"></div><main class="container"><div class="detail-wrapper -active -has-info-box"><div class="detail-header -is-loose"><div class="detail-container"><div class="detail-header-outer-block"><div class="detail-header-content-block"><h1 class="title pub-monochrome-icon-hoverable">equatable 2.0.7 <span class="pkg-page-title-copy"><img class="pub-monochrome-icon pkg-page-title-copy-icon filter-invert-on-dark" src="/static/hash-6oi64i7a/img/content-copy-icon.svg" alt="copy "equatable: ^2.0.7" to clipboard" width="18" height="18" title="Copy "equatable: ^2.0.7" to clipboard" data-copy-content="equatable: ^2.0.7" data-ga-click-event="copy-package-version"/><div class="pkg-page-title-copy-feedback"><span class="code">equatable: ^2.0.7</span> copied to clipboard</div></span></h1><div class="metadata">Published <span><a class="-x-ago" href="" title="Nov 21, 2024" role="button" data-timestamp="1732212857546">5 months ago</a></span> • <a class="-pub-publisher" href="/publishers/fluttercommunity.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-6oi64i7a/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>fluttercommunity.dev</a><span class="package-badge" title="Package is compatible with Dart 3.">Dart 3 compatible</span>• Latest: <span><a href="/packages/equatable" title="View the latest version of equatable">2.0.7</a></span> / <span>Prerelease: <a href="/packages/equatable/versions/3.0.0-dev.1" title="Visit equatable 3.0.0-dev.1 page">3.0.0-dev.1</a></span></div><div class="detail-tags-and-like"><div class="detail-tags"><div class="-pub-tag-badge"><span class="tag-badge-main">SDK</span><a class="tag-badge-sub" href="/packages?q=sdk%3Adart" rel="nofollow" title="Packages compatible with Dart SDK">Dart</a><a class="tag-badge-sub" href="/packages?q=sdk%3Aflutter" rel="nofollow" title="Packages compatible with Flutter SDK">Flutter</a></div><div class="-pub-tag-badge"><span class="tag-badge-main">Platform</span><a class="tag-badge-sub" href="/packages?q=platform%3Aandroid" rel="nofollow" title="Packages compatible with Android platform">Android</a><a class="tag-badge-sub" href="/packages?q=platform%3Aios" rel="nofollow" title="Packages compatible with iOS platform">iOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Alinux" rel="nofollow" title="Packages compatible with Linux platform">Linux</a><a class="tag-badge-sub" href="/packages?q=platform%3Amacos" rel="nofollow" title="Packages compatible with macOS platform">macOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Aweb" rel="nofollow" title="Packages compatible with Web platform">web</a><a class="tag-badge-sub" href="/packages?q=platform%3Awindows" rel="nofollow" title="Packages compatible with Windows platform">Windows</a></div></div><div class="detail-like"><button id="-pub-like-icon-button" class="mdc-icon-button" data-ga-click-event="toggle-like" aria-pressed="false" title="Like this package"><img class="mdc-icon-button__icon" src="/static/hash-6oi64i7a/img/like-inactive.svg" alt="liked status: inactive" width="18" height="18"/><img class="mdc-icon-button__icon mdc-icon-button__icon--on" src="/static/hash-6oi64i7a/img/like-active.svg" alt="liked status: active" width="18" height="18"/></button><span class="likes-count"><span id="likes-count">3.4k</span></span></div></div></div></div></div></div><div class="detail-container"><div class="detail-lead"><div class="detail-metadata-toggle"><div class="detail-metadata-toggle-icon">→</div><h3 class="detail-lead-title">Metadata</h3></div><p class="detail-lead-text">A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.</p><p class="detail-lead-more"><a class="detail-metadata-toggle">More...</a></p></div></div><div class="detail-body"><div class="detail-tabs"><div class="detail-tabs-wide-header"><div class="detail-container"><ul class="detail-tabs-header"><li class="detail-tab tab-button detail-tab-readme-title -active">Readme</li><li class="detail-tab tab-link detail-tab-changelog-title"><a href="/packages/equatable/changelog" role="button">Changelog</a></li><li class="detail-tab tab-link detail-tab-example-title"><a href="/packages/equatable/example" role="button">Example</a></li><li class="detail-tab tab-link detail-tab-installing-title"><a href="/packages/equatable/install" role="button">Installing</a></li><li class="detail-tab tab-link detail-tab-versions-title"><a href="/packages/equatable/versions" role="button">Versions</a></li><li class="detail-tab tab-link detail-tab-analysis-title"><a href="/packages/equatable/score" role="button">Scores</a></li></ul></div></div><div class="detail-container detail-body-main"><div class="detail-tabs-content"><section class="tab-content detail-tab-readme-content -active markdown-body"><img src="https://github.com/felangel/equatable/raw/master/doc/assets/equatable_logo_full.png" width="100%" alt="logo"> <h2 align="center"> Simplify Equality Comparisons </h2> <p align="center"> <a href="https://github.com/felangel/equatable/actions" rel="ugc"> <img alt="Build Status" src="https://github.com/felangel/equatable/workflows/build/badge.svg"> </a> <a href="https://github.com/felangel/equatable/actions" rel="ugc"> <img alt="Code Coverage" src="https://raw.githubusercontent.com/felangel/equatable/master/coverage_badge.svg"> </a> <a href="https://pub.dartlang.org/packages/equatable" rel="ugc"> <img alt="Pub Package" src="https://img.shields.io/pub/v/equatable.svg"> </a> <br> <a href="https://github.com/felangel/equatable" rel="ugc"> <img src="https://img.shields.io/github/stars/felangel/equatable.svg?style=flat&logo=github&colorB=deeppink&label=stars" alt="Star on GitHub"> </a> <a href="https://discord.gg/Hc5KD3g" rel="ugc"> <img src="https://img.shields.io/discord/649708778631200778.svg?logo=discord&color=blue" alt="Discord"> </a> <a href="https://opensource.org/licenses/MIT" rel="ugc"> <img alt="MIT License" src="https://img.shields.io/badge/License-MIT-blue.svg"> </a> </p> <hr> <h2 id="overview" class="hash-header">Overview <a href="#overview" class="hash-link">#</a></h2> <p>Being able to compare objects in <code>Dart</code> often involves having to override the <code>==</code> operator as well as <code>hashCode</code>.</p> <p>Not only is it verbose and tedious, but failure to do so can lead to inefficient code which does not behave as we expect.</p> <p>By default, <code>==</code> returns true if two objects are the same instance.</p> <p>Let's say we have the following class:</p> <pre><code class="language-dart">class Person { const Person(this.name); final String name; } </code></pre> <p>We can create instances of <code>Person</code> like so:</p> <pre><code class="language-dart">void main() { final Person bob = Person("Bob"); } </code></pre> <p>Later if we try to compare two instances of <code>Person</code> either in our production code or in our tests we will run into a problem.</p> <pre><code class="language-dart">print(bob == Person("Bob")); // false </code></pre> <p>For more information about this, you can check out the official <a href="https://www.dartlang.org/guides/language/effective-dart/design#equality" rel="ugc">Dart Documentation</a>.</p> <p>In order to be able to compare two instances of <code>Person</code> we need to change our class to override <code>==</code> and <code>hashCode</code> like so:</p> <pre><code class="language-dart">class Person { const Person(this.name); final String name; @override bool operator ==(Object other) => identical(this, other) || other is Person && runtimeType == other.runtimeType && name == other.name; @override int get hashCode => name.hashCode; } </code></pre> <p>Now if we run the following code again:</p> <pre><code class="language-dart">print(bob == Person("Bob")); // true </code></pre> <p>it will be able to compare different instances of <code>Person</code>.</p> <p>You can see how this can quickly become a hassle when dealing with complex classes. This is where <code>Equatable</code> comes in!</p> <h2 id="what-does-equatable-do" class="hash-header">What does Equatable do? <a href="#what-does-equatable-do" class="hash-link">#</a></h2> <p><code>Equatable</code> overrides <code>==</code> and <code>hashCode</code> for you so you don't have to waste your time writing lots of boilerplate code.</p> <p>There are other packages that will actually generate the boilerplate for you; however, you still have to run the code generation step which is not ideal.</p> <p>With <code>Equatable</code> there is no code generation needed and we can focus more on writing amazing applications and less on mundane tasks.</p> <h2 id="usage" class="hash-header">Usage <a href="#usage" class="hash-link">#</a></h2> <p>First, we need to do add <code>equatable</code> to the dependencies of the <code>pubspec.yaml</code></p> <pre><code class="language-yaml">dependencies: equatable: ^2.0.0 </code></pre> <p>Next, we need to install it:</p> <pre><code class="language-sh"># Dart pub get # Flutter flutter packages get </code></pre> <p>Lastly, we need to extend <code>Equatable</code></p> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name); final String name; @override List<Object> get props => [name]; } </code></pre> <p>When working with json:</p> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name); final String name; @override List<Object> get props => [name]; factory Person.fromJson(Map<String, dynamic> json) { return Person(json['name']); } } </code></pre> <p>We can now compare instances of <code>Person</code> just like before without the pain of having to write all of that boilerplate. <strong>Note:</strong> Equatable is designed to only work with immutable objects so all member variables must be final (This is not just a feature of <code>Equatable</code> - <a href="https://dart.dev/guides/language/effective-dart/design#avoid-defining-custom-equality-for-mutable-classes">overriding a <code>hashCode</code> with a mutable value can break hash-based collections</a>).</p> <p>Equatable also supports <code>const</code> constructors:</p> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name); final String name; @override List<Object> get props => [name]; } </code></pre> <p>Equatable also supports nullable props:</p> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name, [this.age]); final String name; final int? age; @override List<Object?> get props => [name, age]; } </code></pre> <h3 id="tostring-implementation" class="hash-header"><code>toString</code> Implementation <a href="#tostring-implementation" class="hash-link">#</a></h3> <p>Equatable can implement <code>toString</code> method including all the given props. If you want that behaviour for a specific <code>Equatable</code> object, just include the following:</p> <pre><code class="language-dart">@override bool get stringify => true; </code></pre> <p>For instance:</p> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name); final String name; @override List<Object> get props => [name]; @override bool get stringify => true; } </code></pre> <p>For the name <code>Bob</code>, the output will be:</p> <p><code>Person(Bob)</code></p> <p>This flag by default is false and <code>toString</code> will return just the type:</p> <p><code>Person</code></p> <h4 id="equatableconfig">EquatableConfig</h4> <p><code>stringify</code> can also be configured globally for all <code>Equatable</code> instances via <code>EquatableConfig</code></p> <pre><code class="language-dart">EquatableConfig.stringify = true; </code></pre> <p>If <code>stringify</code> is overridden for a specific <code>Equatable</code> class, then the value of <code>EquatableConfig.stringify</code> is ignored. In other words, the local configuration always takes precedence over the global configuration.</p> <p><em>Note: <code>EquatableConfig.stringify</code> defaults to <code>true</code> in debug mode and <code>false</code> in release mode.</em></p> <h2 id="recap" class="hash-header">Recap <a href="#recap" class="hash-link">#</a></h2> <h3 id="without-equatable" class="hash-header">Without Equatable <a href="#without-equatable" class="hash-link">#</a></h3> <pre><code class="language-dart">class Person { const Person(this.name); final String name; @override bool operator ==(Object other) => identical(this, other) || other is Person && runtimeType == other.runtimeType && name == other.name; @override int get hashCode => name.hashCode; } </code></pre> <h3 id="with-equatable" class="hash-header">With Equatable <a href="#with-equatable" class="hash-link">#</a></h3> <pre><code class="language-dart">import 'package:equatable/equatable.dart'; class Person extends Equatable { const Person(this.name); final String name; @override List<Object> get props => [name]; } </code></pre> <h2 id="equatablemixin" class="hash-header">EquatableMixin <a href="#equatablemixin" class="hash-link">#</a></h2> <p>Sometimes it isn't possible to extend <code>Equatable</code> because your class already has a superclass. In this case, you can still get the benefits of <code>Equatable</code> by using the <code>EquatableMixin</code>.</p> <h3 id="usage-2" class="hash-header">Usage <a href="#usage-2" class="hash-link">#</a></h3> <p>Let's say we want to make an <code>EquatableDateTime</code> class, we can use <code>EquatableMixin</code> like so:</p> <pre><code class="language-dart">class EquatableDateTime extends DateTime with EquatableMixin { EquatableDateTime( int year, [ int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0, ]) : super(year, month, day, hour, minute, second, millisecond, microsecond); @override List<Object> get props { return [year, month, day, hour, minute, second, millisecond, microsecond]; } } </code></pre> <p>Now if we want to create a subclass of <code>EquatableDateTime</code>, we can just override <code>props</code>.</p> <pre><code class="language-dart">class EquatableDateTimeSubclass extends EquatableDateTime { final int century; EquatableDateTimeSubclass( this.century, int year,[ int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0, ]) : super(year, month, day, hour, minute, second, millisecond, microsecond); @override List<Object> get props => [...super.props, century]; } </code></pre> <h2 id="benchmarks" class="hash-header">Benchmarks <a href="#benchmarks" class="hash-link">#</a></h2> <p>You can see and run performance benchmarks by heading over to <a href="https://github.com/felangel/equatable/blob/master/benchmarks" rel="ugc">benchmarks</a>.</p> <h2 id="maintainers" class="hash-header">Maintainers <a href="#maintainers" class="hash-link">#</a></h2> <ul> <li><a href="https://github.com/felangel" rel="ugc">Felix Angelov</a></li> </ul> </section></div></div></div><aside class="detail-info-box"><a class="packages-scores" href="/packages/equatable/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">3.41k</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">160</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">points</div></div><div class="packages-score packages-score-downloads" title="Number of downloads of this package during the past 30 days"><div class="packages-score-value -has-value"><span class="packages-score-value-number">3.88M</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">downloads</div></div></a><div class="detail-screenshot-thumbnail"><div class="thumbnail-container" data-thumbnail="/packages/equatable/versions/2.0.7/gen-res/gen/equatable_logo.webp" data-thumbnail-descriptions-json="["The equatable package logo."]" data-ga-click-event="screenshot-thumbnail-click"><img class="thumbnail-image" src="/packages/equatable/versions/2.0.7/gen-res/gen/190x190/equatable_logo.webp" alt="screenshot" title="View screenshots" tabindex="0"/></div><img class="collections-icon" src="/static/hash-6oi64i7a/img/collections_white_24dp.svg" alt="" width="30" height="30" role="presentation"/></div><h3 class="title">Publisher</h3><p><a href="/publishers/fluttercommunity.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-6oi64i7a/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>fluttercommunity.dev</a></p><h3 class="title">Weekly Downloads</h3><div id="-weekly-downloads-sparkline" class="weekly-downloads-sparkline" data-widget="weekly-sparkline" data-weekly-sparkline-points="gHMNaFfRDQBXNA0AkPwNAIXyEACbyQ4A+cENAFqWDgDBwg4AqasQAHQRDgBwRA0AhfkNAOndDwDPRw0ADKEMAPMQDADu+QUAUrkHANxtDQDTGRAArqwNAJ19DQBBOw0AxjgLAAtLCwDe3gwA7jkOACPECwB3igsAw9cKAGYUDAB5NwoAbN8LAGDlCgBVQAsAJ/sLALgRCQCJhgoAaJUKAHAhCgCEpQkAFLsKAD40CgAVEw0Ad7kKAOCDCgDaQwoAUCUKAL31CgDf9QoAYnAJAGovCQA="></div><h3 class="title pkg-infobox-metadata">Metadata</h3><p>A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.</p><p><a class="link" href="https://github.com/felangel/equatable" rel="ugc">Repository (GitHub)</a><br/><a class="link" href="https://github.com/felangel/equatable/issues" rel="ugc">View/report issues</a><br/><a class="link" href="https://github.com/felangel/equatable/blob/master/CONTRIBUTING.md" rel="ugc">Contributing</a><br/></p><h3 class="title">Topics</h3><p><a class="topics-tag" href="/packages?q=topic%3Aequality" rel="nofollow">#equality</a> <a class="topics-tag" href="/packages?q=topic%3Aequals" rel="nofollow">#equals</a></p><h3 class="title">Documentation</h3><p><a class="link" href="https://github.com/felangel/equatable" rel="ugc">Documentation</a><br/><a class="link" href="/documentation/equatable/latest/">API reference</a><br/></p><h3 class="title">Funding</h3><p>Consider supporting this project:<br/><br/><a class="link" href="https://github.com/sponsors/felangel" rel="ugc">github.com</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-6oi64i7a/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>MIT (<a href="/packages/equatable/license">license</a>)</p><h3 class="title">Dependencies</h3><p><a href="/packages/collection" title="^1.15.0">collection</a>, <a href="/packages/meta" title="^1.3.0">meta</a></p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Aequatable" rel="nofollow">Packages that depend on equatable</a></p></aside></div><script type="application/ld+json">{"@context":"http\u003a\u002f\u002fschema.org","@type":"SoftwareSourceCode","name":"equatable","version":"2.0.7","description":"equatable - A Dart package that helps to implement value based equality without needing to explicitly override \u003d\u003d and hashCode.","url":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fequatable","dateCreated":"2019-01-06T19\u003a33\u003a39.683748Z","dateModified":"2024-11-21T18\u003a14\u003a17.546841Z","programmingLanguage":"Dart","image":"https\u003a\u002f\u002fpub.dev\u002fstatic\u002fimg\u002fpub-dev-icon-cover-image.png","license":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fequatable\u002flicense"}</script></div><div class="detail-metadata"><h3 class="detail-metadata-title"><span class="detail-metadata-toggle">←</span> Metadata</h3><div class="detail-info-box"><a class="packages-scores" href="/packages/equatable/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">3.41k</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">160</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">points</div></div><div class="packages-score packages-score-downloads" title="Number of downloads of this package during the past 30 days"><div class="packages-score-value -has-value"><span class="packages-score-value-number">3.88M</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">downloads</div></div></a><div class="detail-screenshot-thumbnail"><div class="thumbnail-container" data-thumbnail="/packages/equatable/versions/2.0.7/gen-res/gen/equatable_logo.webp" data-thumbnail-descriptions-json="["The equatable package logo."]" data-ga-click-event="screenshot-thumbnail-click"><img class="thumbnail-image" src="/packages/equatable/versions/2.0.7/gen-res/gen/190x190/equatable_logo.webp" alt="screenshot" title="View screenshots" tabindex="0"/></div><img class="collections-icon" src="/static/hash-6oi64i7a/img/collections_white_24dp.svg" alt="" width="30" height="30" role="presentation"/></div><h3 class="title">Publisher</h3><p><a href="/publishers/fluttercommunity.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-6oi64i7a/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>fluttercommunity.dev</a></p><h3 class="title">Weekly Downloads</h3><div id="-weekly-downloads-sparkline" class="weekly-downloads-sparkline" data-widget="weekly-sparkline" data-weekly-sparkline-points="gHMNaFfRDQBXNA0AkPwNAIXyEACbyQ4A+cENAFqWDgDBwg4AqasQAHQRDgBwRA0AhfkNAOndDwDPRw0ADKEMAPMQDADu+QUAUrkHANxtDQDTGRAArqwNAJ19DQBBOw0AxjgLAAtLCwDe3gwA7jkOACPECwB3igsAw9cKAGYUDAB5NwoAbN8LAGDlCgBVQAsAJ/sLALgRCQCJhgoAaJUKAHAhCgCEpQkAFLsKAD40CgAVEw0Ad7kKAOCDCgDaQwoAUCUKAL31CgDf9QoAYnAJAGovCQA="></div><h3 class="title pkg-infobox-metadata">Metadata</h3><p>A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.</p><p><a class="link" href="https://github.com/felangel/equatable" rel="ugc">Repository (GitHub)</a><br/><a class="link" href="https://github.com/felangel/equatable/issues" rel="ugc">View/report issues</a><br/><a class="link" href="https://github.com/felangel/equatable/blob/master/CONTRIBUTING.md" rel="ugc">Contributing</a><br/></p><h3 class="title">Topics</h3><p><a class="topics-tag" href="/packages?q=topic%3Aequality" rel="nofollow">#equality</a> <a class="topics-tag" href="/packages?q=topic%3Aequals" rel="nofollow">#equals</a></p><h3 class="title">Documentation</h3><p><a class="link" href="https://github.com/felangel/equatable" rel="ugc">Documentation</a><br/><a class="link" href="/documentation/equatable/latest/">API reference</a><br/></p><h3 class="title">Funding</h3><p>Consider supporting this project:<br/><br/><a class="link" href="https://github.com/sponsors/felangel" rel="ugc">github.com</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-6oi64i7a/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>MIT (<a href="/packages/equatable/license">license</a>)</p><h3 class="title">Dependencies</h3><p><a href="/packages/collection" title="^1.15.0">collection</a>, <a href="/packages/meta" title="^1.3.0">meta</a></p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Aequatable" rel="nofollow">Packages that depend on equatable</a></p></div><p class="detail-lead-back"><a class="detail-metadata-toggle">Back</a></p></div><div id="-screenshot-carousel" class="carousel"><fab id="-carousel-prev" class="mdc-fab carousel-prev carousel-nav" data-mdc-auto-init="MDCRipple" title="Previous" data-ga-click-event="screenshot-carousel-prev-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-6oi64i7a/img/keyboard_arrow_left.svg" alt="previous" width="24" height="24" aria-hidden="true"/></fab><div id="-image-container" class="image-container"></div><fab id="-carousel-next" class="mdc-fab carousel-next carousel-nav" data-mdc-auto-init="MDCRipple" title="Next" data-ga-click-event="screenshot-carousel-next-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-6oi64i7a/img/keyboard_arrow_right.svg" alt="next" width="24" height="24" aria-hidden="true"/></fab><p id="-screenshot-description" class="screenshot-description"></p></div></main><footer class="site-footer"><a class="link" href="https://dart.dev/">Dart language</a><a class="link sep" href="/report?subject=package%3Aequatable&url=https%3A%2F%2Fpub.dev%2Fpackages%2Fequatable">Report package</a><a class="link sep" href="/policy">Policy</a><a class="link sep" href="https://www.google.com/intl/en/policies/terms/">Terms</a><a class="link sep" href="https://developers.google.com/terms/">API Terms</a><a class="link sep" href="/security">Security</a><a class="link sep" href="https://www.google.com/intl/en/policies/privacy/">Privacy</a><a class="link sep" href="/help">Help</a><a class="link icon sep" href="/feed.atom"><img class="inline-icon" src="/static/hash-6oi64i7a/img/rss-feed-icon.svg" alt="RSS" width="20" height="20" title="RSS/atom feed"/></a><a class="link icon github_issue" href="https://github.com/dart-lang/pub-dev/issues/new"><img class="inline-icon" src="/static/hash-6oi64i7a/img/bug-report-white-96px.png" alt="bug report" width="20" height="20" title="Report an issue with this site"/></a></footer><script src="/static/hash-6oi64i7a/highlight/highlight-with-init.js" defer="defer"></script></body></html>