shouldSkip function

bool shouldSkip(
  1. String key
)

Implementation

bool shouldSkip(String key) {
  final rules = _filters["skipRules"] ?? {};

  if (rules["digitOnly"] == true && RegExp(r'^\d+$').hasMatch(key)) {
    return true;
  }

  if (rules["hexOnly"] == true &&
      RegExp(
        r'^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?([0-9a-fA-F]{2})?$',
      ).hasMatch(key)) {
    return true;
  }

  if ((rules["minLength"] ?? 0) > 0 && key.length < rules["minLength"]) {
    return true;
  }

  if ((rules["maxLength"] ?? 0) > 0 && key.length > rules["maxLength"]) {
    return true;
  }

  return false;
}