captures method
Extracts only this route's decoded captures from a Roux match.
Implementation
Map<String, List<String>> captures(Map<String, String> values) {
if (parameterNames.isEmpty) return const <String, List<String>>{};
final captures = <String, List<String>>{};
for (final part in _parts) {
switch (part) {
case _ParameterPart(:final name):
final value = values[name];
if (value != null) {
captures[name] = <String>[Uri.decodeComponent(value)];
}
case _RestPart(:final name):
final value = values[name];
if (value != null && value.isNotEmpty) {
captures[name] = value
.split('/')
.map(Uri.decodeComponent)
.toList(growable: false);
}
case _StaticPart():
break;
}
}
return captures;
}