FlutterStandardReader

Objective-C

@interface FlutterStandardReader : NSObject

Swift

class FlutterStandardReader : NSObject

A reader of the Flutter standard binary encoding.

See FlutterStandardMessageCodec for details on the encoding.

The encoding is extensible via subclasses overriding readValueOfType.

  • Create a new FlutterStandardReader who reads from \p data.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithData:(nonnull NSData *)data;

    Swift

    init(data: Data)
  • Returns YES when the reader hasn’t reached the end of its data.

    Declaration

    Objective-C

    - (BOOL)hasMore;

    Swift

    func hasMore() -> Bool
  • Reads a byte value and increments the position.

    Declaration

    Objective-C

    - (UInt8)readByte;

    Swift

    func readByte() -> UInt8
  • Reads a sequence of byte values of \p length and increments the position.

    Declaration

    Objective-C

    - (void)readBytes:(nonnull void *)destination length:(NSUInteger)length;

    Swift

    func readBytes(_ destination: UnsafeMutableRawPointer, length: UInt)
  • Reads a sequence of byte values of \p length and increments the position.

    Declaration

    Objective-C

    - (nonnull NSData *)readData:(NSUInteger)length;

    Swift

    func readData(_ length: UInt) -> Data
  • Reads a 32-bit unsigned integer representing a collection size and increments the position.

    Declaration

    Objective-C

    - (UInt32)readSize;

    Swift

    func readSize() -> UInt32
  • Advances the read position until it is aligned with \p alignment.

    Declaration

    Objective-C

    - (void)readAlignment:(UInt8)alignment;

    Swift

    func readAlignment(_ alignment: UInt8)
  • Read a null terminated string encoded with UTF-8/

    Declaration

    Objective-C

    - (nonnull NSString *)readUTF8;

    Swift

    func readUTF8() -> String
  • Reads a byte for FlutterStandardField the decodes a value matching that type.

    See also: -[FlutterStandardWriter writeValue]

    Declaration

    Objective-C

    - (nullable id)readValue;

    Swift

    func readValue() -> Any?
  • Decodes a value matching the \p type specified.

    See also:

    • FlutterStandardField
    • -[FlutterStandardWriter writeValue]

    Declaration

    Objective-C

    - (nullable id)readValueOfType:(UInt8)type;

    Swift

    func readValue(ofType type: UInt8) -> Any?