Skip to content

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

@AlxSidenko

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;
}

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