assertBetween method
Asserts that this number is between min and max (inclusive).
Throws a test failure if this number is not between min and max.
Example:
15.assertBetween(10, 20); // Passes
10.assertBetween(10, 20); // Passes (boundary)
20.assertBetween(10, 20); // Passes (boundary)
5.assertBetween(10, 20); // Fails
25.assertBetween(10, 20); // Fails
min: The minimum value of the range.max: The maximum value of the range.message: Optional custom message for the failure reason.
Implementation
void assertBetween(num min, num max, {String? message}) {
expect(this >= min && this <= max, isTrue,
reason: message ?? 'Expected $this to be between $min and $max');
}