generateRoute method
Implementation
Route<dynamic> generateRoute(RouteSettings settings) {
Arguments? arguments;
if (settings.arguments is Arguments) {
arguments = settings.arguments as Arguments?;
}
switch (settings.name) {
case RouterApi.pageRoute:
if ((arguments != null) && (arguments.mainArgument != null)) {
return getRoute(arguments.mainArgument!, arguments.parameters);
}
break;
case RouterApi.messageRoute:
if (arguments != null) {
if (arguments.parameters != null) {
var message = arguments.parameters!['message'];
if (message != null) {
return error(arguments.mainArgument!, message);
} else {
return error(arguments.mainArgument!, 'Unknown error (3)');
}
} else {
return error2('Unknown error (1)');
}
} else {
return error2('Unknown error (2)');
}
default:
var settingsUri = Uri.parse(settings.name!);
var path = settingsUri.path;
var parameters = settingsUri.queryParameters;
return getRoute(path, parameters);
}
return error2('No route defined for ${settings.name}!');
}