BfdStatus.fromJson constructor

BfdStatus.fromJson(
  1. Object? j
)

Implementation

factory BfdStatus.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BfdStatus(
    bfdSessionInitializationMode:
        switch (json['bfdSessionInitializationMode']) {
          null => null,
          Object $1 => decodeString($1),
        },
    configUpdateTimestampMicros:
        switch (json['configUpdateTimestampMicros']) {
          null => null,
          Object $1 => decodeInt64($1),
        },
    controlPacketCounts: switch (json['controlPacketCounts']) {
      null => null,
      Object $1 => BfdStatusPacketCounts.fromJson($1),
    },
    controlPacketIntervals: switch (json['controlPacketIntervals']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) PacketIntervals.fromJson(i)],
      _ => throw const FormatException(
        '"controlPacketIntervals" is not a list',
      ),
    },
    localDiagnostic: switch (json['localDiagnostic']) {
      null => null,
      Object $1 => decodeString($1),
    },
    localState: switch (json['localState']) {
      null => null,
      Object $1 => decodeString($1),
    },
    negotiatedLocalControlTxIntervalMs:
        switch (json['negotiatedLocalControlTxIntervalMs']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    rxPacket: switch (json['rxPacket']) {
      null => null,
      Object $1 => BfdPacket.fromJson($1),
    },
    txPacket: switch (json['txPacket']) {
      null => null,
      Object $1 => BfdPacket.fromJson($1),
    },
    uptimeMs: switch (json['uptimeMs']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
  );
}