WallPaperSettings.deserialize constructor

WallPaperSettings.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory WallPaperSettings.deserialize(BinaryReader reader) {
  // Read [WallPaperSettings] fields.
  final flags = reader.readInt32();
  final blur = (flags & 2) != 0;
  final motion = (flags & 4) != 0;
  final hasBackgroundColorField = (flags & 1) != 0;
  final backgroundColor = hasBackgroundColorField ? reader.readInt32() : null;
  final hasSecondBackgroundColorField = (flags & 16) != 0;
  final secondBackgroundColor =
      hasSecondBackgroundColorField ? reader.readInt32() : null;
  final hasThirdBackgroundColorField = (flags & 32) != 0;
  final thirdBackgroundColor =
      hasThirdBackgroundColorField ? reader.readInt32() : null;
  final hasFourthBackgroundColorField = (flags & 64) != 0;
  final fourthBackgroundColor =
      hasFourthBackgroundColorField ? reader.readInt32() : null;
  final hasIntensityField = (flags & 8) != 0;
  final intensity = hasIntensityField ? reader.readInt32() : null;
  final hasRotationField = (flags & 16) != 0;
  final rotation = hasRotationField ? reader.readInt32() : null;
  final hasEmoticonField = (flags & 128) != 0;
  final emoticon = hasEmoticonField ? reader.readString() : null;

  // Construct [WallPaperSettings] object.
  final returnValue = WallPaperSettings(
    blur: blur,
    motion: motion,
    backgroundColor: backgroundColor,
    secondBackgroundColor: secondBackgroundColor,
    thirdBackgroundColor: thirdBackgroundColor,
    fourthBackgroundColor: fourthBackgroundColor,
    intensity: intensity,
    rotation: rotation,
    emoticon: emoticon,
  );

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