CodeSettings.deserialize constructor

CodeSettings.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory CodeSettings.deserialize(BinaryReader reader) {
  // Read [CodeSettings] fields.
  final flags = reader.readInt32();
  final allowFlashcall = (flags & 1) != 0;
  final currentNumber = (flags & 2) != 0;
  final allowAppHash = (flags & 16) != 0;
  final allowMissedCall = (flags & 32) != 0;
  final allowFirebase = (flags & 128) != 0;
  final hasLogoutTokensField = (flags & 64) != 0;
  final logoutTokens = hasLogoutTokensField ? reader.readVectorBytes() : null;
  final hasTokenField = (flags & 256) != 0;
  final token = hasTokenField ? reader.readString() : null;
  final appSandbox = (flags & 256) != 0;

  // Construct [CodeSettings] object.
  final returnValue = CodeSettings(
    allowFlashcall: allowFlashcall,
    currentNumber: currentNumber,
    allowAppHash: allowAppHash,
    allowMissedCall: allowMissedCall,
    allowFirebase: allowFirebase,
    logoutTokens: logoutTokens,
    token: token,
    appSandbox: appSandbox,
  );

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