DocumentChange.fromJson constructor

DocumentChange.fromJson(
  1. Object? j
)

Implementation

factory DocumentChange.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return DocumentChange(
    document: switch (json['document']) {
      null => null,
      Object $1 => Document.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'),
    },
    removedTargetIds: switch (json['removedTargetIds']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt(i)],
      _ => throw const FormatException('"removedTargetIds" is not a list'),
    },
  );
}