gotoPage method
void
gotoPage(})
Implementation
void gotoPage(bool clearHistory, String? appId, String? pageId,
{Map<String, dynamic>? parameters, String? errorString}) {
if (appId == null) {
throw Exception('Error: gotoPage(null)');
}
if (pageId != null) {
if (navigatorKey.currentState != null) {
if (clearHistory) {
navigatorKey.currentState!.pushNamedAndRemoveUntil(
RouterApi.pageRoute, (_) => false,
arguments: Arguments('$appId/$pageId', parameters));
} else {
navigatorKey.currentState!.pushNamed(RouterApi.pageRoute,
arguments: Arguments('$appId/$pageId', parameters));
}
} else {
throw Exception(
"Can't pushNamed page $appId/$pageId because navigatorKey.currentState is null");
}
} else {
if (clearHistory) {
navigatorKey.currentState!.pushNamedAndRemoveUntil(
RouterApi.messageRoute, (_) => false,
arguments: Arguments(appId, {'message': errorString}));
} else {
navigatorKey.currentState!.pushNamed(RouterApi.messageRoute,
arguments: Arguments(appId, {'message': errorString}));
}
}
}