stringArg function

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

A string argument of a rule at index. Numbers and booleans are converted with livrToString. Throws LivrSchemaException for other values.

Implementation

String stringArg(List<Object?> args, int index, String ruleName) {
  final arg = ruleArg(args, index, ruleName);
  if (isPrimitive(arg)) return livrToString(arg);
  throw LivrSchemaException('Rule [$ruleName] expects a string, got [$arg]');
}