localhost static method

Validator<String> localhost({
  1. String? error,
})

Implementation

static Validator<String> localhost({String? error}) => (value, context) {
      final ip = context.resources.tryGet<IpResource>(
        value,
        temp: !context.usePermanentCache,
      );
      if (ip == null) return (false, 'ip resource not found in context');
      if (ip.isLocalhost) {
        return (true, null);
      }
      return (false, error ?? context.errors.ipErrors.localhost());
    };