checkPathMatchesRoute method
Implementation
bool checkPathMatchesRoute(String path, List<String> routes) {
//bool allowSuffix(String value) => value.endsWith("/");
// The first entry in the list of routes will determine whether it allowsSuffix or not.
// We'll make a special exception or "/" as I cant think of a use case for it and it can cause a lot of confusion... TODO: revisit this decision after more use-case testing
bool allowSuffix = routes[0].endsWith("/") && routes[0] != "/";
for (var i = 0; i < routes.length; i++) {
//print("checking: $basePath${routes[i]}");
final regExp = pathToRegExp('$basePath${routes[i]}', prefix: allowSuffix, caseSensitive: widget.caseSensitive);
if (regExp.hasMatch("$path")) return true;
}
return false;
}