TargetChange.fromJson constructor

TargetChange.fromJson(
  1. Object? j
)

Implementation

factory TargetChange.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return TargetChange(
    targetChangeType: switch (json['targetChangeType']) {
      null => TargetChange_TargetChangeType.$default,
      Object $1 => TargetChange_TargetChangeType.fromJson($1),
    },
    targetIds: switch (json['targetIds']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt(i)],
      _ => throw const FormatException('"targetIds" is not a list'),
    },
    cause: switch (json['cause']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    resumeToken: switch (json['resumeToken']) {
      null => Uint8List(0),
      Object $1 => decodeBytes($1),
    },
    readTime: switch (json['readTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
  );
}