whereCheck method

RegExp? whereCheck(
  1. String param
)

The Route.where regex of param as a full match (^(?:regex)$), built once. Null when param has no where. The router checks the param with it again after % decoding, so %2F can not sneak a / past a rule like [^/]+.

Implementation

RegExp? whereCheck(String param) {
  String? regex = wheres?[param];
  if (regex == null) return null;
  // dotAll: `.` must match a decoded `%0A` too, like it matches the
  // raw `%0A` text in the route regex
  return (_whereChecks ??= <String, RegExp>{})[param] ??= RegExp(
    '^(?:$regex)\$',
    dotAll: true,
  );
}