wildcard constant

String const wildcard

Segment name for the wildcard segment.

This value is always the asterisk character.

Pattern strings would be hard to read if this constant was used in them (e.g. "~/foo/${Pattern.wildcard}"), but it could be used as the name of the returned parameter.

    final pattern = Pattern('~/foo/*');
    ...
    params = pattern.match(pathComponents);
    if (params != null) {
      final m = params[Pattern.wildcard]; // instead of params['*']
      ...
    }

Implementation

static const String wildcard = '*';