ruleArg function

Object? ruleArg(
  1. List<Object?> args,
  2. int index,
  3. String ruleName
)

The argument of a rule at index, for rule builders. Throws LivrSchemaException when the schema does not have it.

Implementation

Object? ruleArg(List<Object?> args, int index, String ruleName) {
  if (index >= args.length) {
    throw LivrSchemaException(
      'Rule [$ruleName] expects at least ${index + 1} argument(s), '
      'got ${args.length}',
    );
  }
  return args[index];
}