getPageContextInfoWithRoute static method

PageContextInfo getPageContextInfoWithRoute(
  1. ModalRoute modalRoute
)

Implementation

static PageContextInfo getPageContextInfoWithRoute(ModalRoute modalRoute) {
  var settings = modalRoute.settings;
  var fullPageId = settings.name;
  if (fullPageId == null) {
    throw Exception('No page selected');
  }
  var split = fullPageId.split('/');
  if (split.length < 2) {
    throw Exception('Page name has unexpected format: $fullPageId');
  }
  var appId = split[0];
  var pageId = split[1];
  Map<String, dynamic>? parameters;
  if (settings.arguments != null) {
    parameters = settings.arguments as Map<String, dynamic>;
  }
  return PageContextInfo(appId, pageId, parameters: parameters);
}