Route.fromJson constructor

Route.fromJson(
  1. Object? j
)

Implementation

factory Route.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Route(
    asPaths: switch (json['asPaths']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RouteAsPath.fromJson(i)],
      _ => throw const FormatException('"asPaths" is not a list'),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    destRange: switch (json['destRange']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopGateway: switch (json['nextHopGateway']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopHub: switch (json['nextHopHub']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopIlb: switch (json['nextHopIlb']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopInstance: switch (json['nextHopInstance']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopInterRegionCost: switch (json['nextHopInterRegionCost']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    nextHopInterconnectAttachment:
        switch (json['nextHopInterconnectAttachment']) {
          null => null,
          Object $1 => decodeString($1),
        },
    nextHopIp: switch (json['nextHopIp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopMed: switch (json['nextHopMed']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    nextHopNetwork: switch (json['nextHopNetwork']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopOrigin: switch (json['nextHopOrigin']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopPeering: switch (json['nextHopPeering']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nextHopVpnTunnel: switch (json['nextHopVpnTunnel']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => RouteParams.fromJson($1),
    },
    priority: switch (json['priority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    routeStatus: switch (json['routeStatus']) {
      null => null,
      Object $1 => decodeString($1),
    },
    routeType: switch (json['routeType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    tags: switch (json['tags']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"tags" is not a list'),
    },
    warnings: switch (json['warnings']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Warnings.fromJson(i)],
      _ => throw const FormatException('"warnings" is not a list'),
    },
  );
}