HostRule.fromJson constructor

HostRule.fromJson(
  1. Object? j
)

Implementation

factory HostRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HostRule(
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    hosts: switch (json['hosts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"hosts" is not a list'),
    },
    pathMatcher: switch (json['pathMatcher']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}