PathMatcher.fromJson constructor

PathMatcher.fromJson(
  1. Object? j
)

Implementation

factory PathMatcher.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PathMatcher(
    defaultCustomErrorResponsePolicy:
        switch (json['defaultCustomErrorResponsePolicy']) {
          null => null,
          Object $1 => CustomErrorResponsePolicy.fromJson($1),
        },
    defaultRouteAction: switch (json['defaultRouteAction']) {
      null => null,
      Object $1 => HttpRouteAction.fromJson($1),
    },
    defaultService: switch (json['defaultService']) {
      null => null,
      Object $1 => decodeString($1),
    },
    defaultUrlRedirect: switch (json['defaultUrlRedirect']) {
      null => null,
      Object $1 => HttpRedirectAction.fromJson($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    headerAction: switch (json['headerAction']) {
      null => null,
      Object $1 => HttpHeaderAction.fromJson($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    pathRules: switch (json['pathRules']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) PathRule.fromJson(i)],
      _ => throw const FormatException('"pathRules" is not a list'),
    },
    routeRules: switch (json['routeRules']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) HttpRouteRule.fromJson(i)],
      _ => throw const FormatException('"routeRules" is not a list'),
    },
  );
}