FactCheck.deserialize constructor

FactCheck.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory FactCheck.deserialize(BinaryReader reader) {
  // Read [FactCheck] fields.
  final flags = reader.readInt32();
  final needCheck = (flags & 1) != 0;
  final hasCountryField = (flags & 2) != 0;
  final country = hasCountryField ? reader.readString() : null;
  final hasTextField = (flags & 2) != 0;
  final text =
      hasTextField ? reader.readObject() as TextWithEntitiesBase : null;
  final hash = reader.readInt64();

  // Construct [FactCheck] object.
  final returnValue = FactCheck(
    needCheck: needCheck,
    country: country,
    text: text,
    hash: hash,
  );

  // Now return the deserialized [FactCheck].
  return returnValue;
}