parsePath function

List<SepPath> parsePath(
  1. String path
)

Implementation

List<SepPath> parsePath(String path){
  if(path.isEmpty) return [];
  // if(path == '/') return [SepPath(null, PathType.root)];
  return path.split('/').map((sep){
    if(sep.isEmpty) {
      return SepPath(null, PathType.root);
    } else if(sep.startsWith('*')) {
      return SepPath(sep.substring(1), PathType.wildcard);
    } else if(sep.startsWith(':')) {
      return SepPath(sep.substring(1), PathType.dynamic);
    } else {
      return SepPath(sep, PathType.static);
    }
  }).toList();
}