BgpRouteAsPath.fromJson constructor

BgpRouteAsPath.fromJson(
  1. Object? j
)

Implementation

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