Line data Source code
1 : import 'route_info.dart'; 2 : 3 : class Matcher { 4 : final String path; 5 : final RegExp matcher; 6 : 7 1 : const Matcher(this.path, this.matcher); 8 : 9 1 : RouteInfo? matchWith(expPath) { 10 2 : final match = matcher.firstMatch(expPath); 11 : 12 : if (match == null) { 13 : return null; 14 : } 15 : 16 : final values = 17 5 : List.generate(match.groupCount, (index) => match.group(index + 1)); 18 2 : final data = Map.fromIterables(match.groupNames, values); 19 : 20 2 : return RouteInfo(path: path, data: data); 21 : } 22 : }