setPageName method
Implementation
void setPageName(
BuildContext context,
String pageName,
) {
final pageSettings = ModalRoute.of(context)?.settings;
assert(() {
if (pageSettings == null) {
throw FlutterError('Given context has no route');
}
return true;
}());
assert(() {
if (pageSettings is! UpdatablePageNameMixin) {
throw FlutterError(
'Route of this context is not of type AsyncPageNameMixin. '
'You cannot set page name of such page.'
' Add the AsyncPageNameMixing to the page.');
}
return true;
}());
if ((pageSettings as UpdatablePageNameMixin)._pageNameNotifier.value !=
pageName) {
WidgetsBinding.instance.addPostFrameCallback((_) {
pageSettings._pageNameNotifier.value = pageName;
});
}
}