Skip to content

Wrong hashCode and equality check for Map<String, dynamic> #413

Description

@AlxSidenko

In one of my models i have a property like this 'final Map<String, dynamic>? extra'.
How it's handling now in hashCode and ==:

hashCode
...
l$extra

==
...
final l$extra = extra;
    final lOther$extra = other.extra;
    if (l$extra != lOther$extra) {
      return false;
}

How it must be:

hashCode
...
l$extra == null ? null : const DeepCollectionEquality().hash(l$extra)

==
...
final l$extra = extra;
    final lOther$extra = other.extra;
    if (!const DeepCollectionEquality().equals(l$extra, lOther$extra)) {
      return false;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions