add<T extends AppRoute> method
dynamic
add<T extends AppRoute>({})
Implementation
add<T extends AppRoute>({
required String path,
required T onParse(Map<String, String> data),
required List<Page> onBuild(T route),
AppRoute Function(E state)? onGuard,
void Function(E state)? onPop,
AppRoutes? children
}) {
assert(!definitions.containsKey(T), 'duplicate route: $T');
_homePath ??= path;
final shadowPath = _getPaths(path).join();
assert(shadowPath.isEmpty, 'duplicate path: $path${(path != shadowPath) ? ' shadows $shadowPath' : ''}');
definitions[T] = _RouteDef<E, T>(path: path, onParse: onParse, onBuild: onBuild, onGuard: onGuard, onPop: onPop, children: children);
if(path == _homePath) {
state._route = homeRoute;
}
if(children != null) {
children._root = _root;
children._parent = this;
children.state._route = children.homeRoute;
}
}