How to test not equal with matcher in flutter How to test not equal with matcher in flutter flutter flutter

How to test not equal with matcher in flutter


You can use isNot() to negate the equals() matcher.

final x = 1;final y = 2;expect(x, isNot(equals(y)));

Or as mentioned in the comments:

expect(x != y, true)

That actually seems a bit more readable to me.