BgpRoute.fromJson constructor

BgpRoute.fromJson(
  1. Object? j
)

Implementation

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