AutoSaveSettings.deserialize constructor

AutoSaveSettings.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory AutoSaveSettings.deserialize(BinaryReader reader) {
  // Read [AutoSaveSettings] fields.
  final flags = reader.readInt32();
  final photos = (flags & 1) != 0;
  final videos = (flags & 2) != 0;
  final hasVideoMaxSizeField = (flags & 4) != 0;
  final videoMaxSize = hasVideoMaxSizeField ? reader.readInt64() : null;

  // Construct [AutoSaveSettings] object.
  final returnValue = AutoSaveSettings(
    photos: photos,
    videos: videos,
    videoMaxSize: videoMaxSize,
  );

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