Charith Hettiarachchi
Charith Hettiarachchi

Reputation: 432

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.

Thanks!

Upvotes: 10

Views: 3615

Answers (1)

Ritesh Singh
Ritesh Singh

Reputation: 1100

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.

Upvotes: 12

Related Questions