Thanks to visit codestin.com
Credit goes to github.com

Skip to content

KeySet.hashCode depends on ordering of keys provided to constructor #38919

Closed
@shyndman

Description

@shyndman

Simple example:

final a = LogicalKeySet(LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.arrowRight);
final b = LogicalKeySet(LogicalKeyboardKey.arrowRight, LogicalKeyboardKey.shiftLeft);
print(a == b); // true 
print(a.hashCode == b.hashCode); // false 

It appears that the Set literal's iteration order is influenced by insertion order. See use of hashList in KeySet.hashCode.

cc @gspencergoog

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions