Closed blaueeiner closed 4 years ago
Either
will use ==
for equality. However, [1, 2, 3] != [1, 2, 3]
, because of the way Dart compares List
s.
For reference: https://stackoverflow.com/questions/10404516/how-can-i-compare-lists-for-equality-in-dart
If you are using Flutter, use listEquals
Edit:
You may also use IList
instead. It correctly implements the ==
operator to make an item per item comparison. Plus, it has the functional methods from dartz, yay! Be warned, though, that this is a little less performatic.
Thank you @mateusfccp that is true. So what I have to do in my context is to write a custom matcher if there is no other way.
I found the CustomMatcher class in the docs. The 'actual' is implemented that is clear but where to get expected from to then return a boolean after comparing both with listEquals()?
PS: I think IList is not a good solution in my context but still a good point.
This is as solved as it will be, right? Closing for now.
Hi Dartz Community, I got another issue when using Dartz connected with flutter_test package.
This is my code:
This is the error: Expected: Right<Failure, List>:<Right([ActivityModel])>
Actual: Right<Failure, List>:<Right([ActivityModel])>
For me somehow this does not make any sense. Hopefully you can help me :)