PathRule.fromJson constructor

PathRule.fromJson(
  1. Object? j
)

Implementation

factory PathRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PathRule(
    customErrorResponsePolicy: switch (json['customErrorResponsePolicy']) {
      null => null,
      Object $1 => CustomErrorResponsePolicy.fromJson($1),
    },
    paths: switch (json['paths']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"paths" is not a list'),
    },
    routeAction: switch (json['routeAction']) {
      null => null,
      Object $1 => HttpRouteAction.fromJson($1),
    },
    service: switch (json['service']) {
      null => null,
      Object $1 => decodeString($1),
    },
    urlRedirect: switch (json['urlRedirect']) {
      null => null,
      Object $1 => HttpRedirectAction.fromJson($1),
    },
  );
}