fromJson static method

RouteQueueEntry fromJson(
  1. Map json,
  2. NRouterDelegate delegate
)

Implementation

static RouteQueueEntry fromJson(Map json, NRouterDelegate delegate) {
  if (json
      case {
        'path': String? path,
        'params': Map params,
        'queryParams': Map queryParams,
        'groupId': Object? groupId,
        'index': int index,
        'id': int id,
        'pageKey': String pageKey,
      }) {
    final root = delegate.rootPage;
    final route = root.getNPageFromIndex(index)!;

    /// reset route id
    route.resetId(id);

    return RouteQueueEntry._internal(
      id: id,
      path: path,
      queryParams: queryParams,
      params: params,
      nPage: route,
      groupId: groupId,
      pageKey: ValueKey(pageKey),
    );
  }
  throw RouteQueueFromJosnError(data: json);
}