HttpRouteRuleMatch.fromJson constructor

HttpRouteRuleMatch.fromJson(
  1. Object? j
)

Implementation

factory HttpRouteRuleMatch.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HttpRouteRuleMatch(
    fullPathMatch: switch (json['fullPathMatch']) {
      null => null,
      Object $1 => decodeString($1),
    },
    headerMatches: switch (json['headerMatches']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) HttpHeaderMatch.fromJson(i)],
      _ => throw const FormatException('"headerMatches" is not a list'),
    },
    ignoreCase: switch (json['ignoreCase']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    metadataFilters: switch (json['metadataFilters']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) MetadataFilter.fromJson(i)],
      _ => throw const FormatException('"metadataFilters" is not a list'),
    },
    pathTemplateMatch: switch (json['pathTemplateMatch']) {
      null => null,
      Object $1 => decodeString($1),
    },
    prefixMatch: switch (json['prefixMatch']) {
      null => null,
      Object $1 => decodeString($1),
    },
    queryParameterMatches: switch (json['queryParameterMatches']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) HttpQueryParameterMatch.fromJson(i),
      ],
      _ => throw const FormatException(
        '"queryParameterMatches" is not a list',
      ),
    },
    regexMatch: switch (json['regexMatch']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}