boolean function

LivrRule boolean(
  1. List<Object?> args,
  2. RuleContext context
)

boolean: the value must be true, false, 1, 0, '1', '0', 'true' or 'false', and the output is a bool. Strings are case-sensitive: 'True' is not a boolean.

Implementation

LivrRule boolean(List<Object?> args, RuleContext context) {
  if (args.isNotEmpty) {
    throw const LivrSchemaException('Rule [boolean] takes no arguments');
  }
  return _boolean;
}