FlutterStandardWriter

Objective-C

@interface FlutterStandardWriter : NSObject

Swift

class FlutterStandardWriter : NSObject

A writer of the Flutter standard binary encoding.

See FlutterStandardMessageCodec for details on the encoding.

The encoding is extensible via subclasses overriding writeValue.

  • Create a FlutterStandardWriter who will write to \p data.

    Declaration

    Objective-C

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

    Swift

    init(data: NSMutableData)
  • Write a 8-bit byte.

    Declaration

    Objective-C

    - (void)writeByte:(UInt8)value;

    Swift

    func writeByte(_ value: UInt8)
  • Write an array of \p bytes of size \p length.

    Declaration

    Objective-C

    - (void)writeBytes:(nonnull const void *)bytes length:(NSUInteger)length;

    Swift

    func writeBytes(_ bytes: UnsafeRawPointer, length: UInt)
  • Write an array of bytes contained in \p data.

    Declaration

    Objective-C

    - (void)writeData:(nonnull NSData *)data;

    Swift

    func write(_ data: Data)
  • Write 32-bit unsigned integer that represents a \p size of a collection.

    Declaration

    Objective-C

    - (void)writeSize:(UInt32)size;

    Swift

    func writeSize(_ size: UInt32)
  • Write zero padding until data is aligned with \p alignment.

    Declaration

    Objective-C

    - (void)writeAlignment:(UInt8)alignment;

    Swift

    func writeAlignment(_ alignment: UInt8)
  • Write a string with UTF-8 encoding.

    Declaration

    Objective-C

    - (void)writeUTF8:(nonnull NSString *)value;

    Swift

    func writeUTF8(_ value: String)
  • Introspects into an object and writes its representation. *

    • Supported Data Types:
    • - NSNull
    • - NSNumber
    • - NSString (as UTF-8)
    • - FlutterStandardTypedData
    • - NSArray of supported types
    • - NSDictionary of supporte types *
    • NSAsserts on failure.

    Declaration

    Objective-C

    - (void)writeValue:(nonnull id)value;

    Swift

    func writeValue(_ value: Any)