isTrue static method

bool isTrue(
  1. bool expression, [
  2. String message = DEFAULT_IS_TRUE_EX_MESSAGE
])

Validate that the argument condition is [true] otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.

Validate.isTrue(i > 0.0, "The value must be greater than zero: $value");

expression the boolean expression to check message the exception message if invalid, not null Throws ArgumentError if expression is false

Implementation

static bool isTrue(final bool expression,
    [final String message = DEFAULT_IS_TRUE_EX_MESSAGE]) =>
    expect.isTrue(expression, message: () => message);