How to test if a value is greater than in flutter test


I want to check if one value is greater than another value with flutter testing. I know that we can use expect to check if one value is equal to another value.

expect(valueOne, valueTwo);

But how can I check if valueOne is greaterThan valueTwo.



This is what you are looking for :
expect(valueOne, greaterThanOrEqualTo(valueTwo))

I noticed that flutter community is not very helpful when it comes to writing tests. So if you need any matcher read the docs. The matcher library is used to match the expected value. We have different methods which you can combine with expect(value, matcherFunction) and the unit test should work.

Answered By – Ritesh Singh

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *