Closed javicerezuela closed 2 years ago
The states are equal, because in your GameState class you override props to be a list of Sets (the curly brackets). Instead, it should be:
@override
List<Object?> get props => [
status,
startTime,
timeRemaining,
totalTime,
letters,
forced,
currentWord,
abilities,
level,
points,
usingAbility,
usedAbility,
];
@milouw thanks for the answer, I see the problem, I will change the code! but it should be working anyway, right? the two list of sets are different, so the assert should not fail. Or am I missing something?
It would work if you set the timeRemaining
to 50 for example, but since you set it to 0 it gets ignored because 0 (from points
) is already in the set. The same goes for 1 (from level
). So in the end, Equatable compares two sets that look something like {0, 1, false}
and the change is unnoticeable.
Ok, now I understand, thanks!
Describe the bug I am using flutter bloc for state management, and I have found that sometimes two different states are treated as equals
To Reproduce This is the state class
Now you can run this code
Expected behavior
state1
andstate2
should be differentVersion Dart SDK version: 2.16.2 (stable) (Tue Mar 22 13:15:13 2022 +0100) on "windows_x64"