handle method

  1. @override
void handle(
  1. GuardContext<ErrorReporter> ctx,
  2. PropertyContext field
)
override

Implementation

@override
void handle(GuardContext ctx, PropertyContext field) {
  if (field.value is! String) {
    final str = message ?? 'The value must be a string';
    final error = ctx.errorReporter.format('string', field, str, {});
    ctx.errorReporter.report('string', field.name, error);
  }
}