| Flutter macOS Embedder |

Instance Methods | List of all members
FlutterStandardWriter Class Reference

`#import <FlutterCodecs.h>`

Inheritance diagram for FlutterStandardWriter:

## Instance Methods
(instancetype) | - initWithData:
(void) | - writeByte:
(void) | - writeBytes:length:
(void) | - writeData:
(void) | - writeSize:
(void) | - writeAlignment:
(void) | - writeUTF8:
(void) | - writeValue:

## Detailed Description

A writer of the Flutter standard binary encoding.

See `FlutterStandardMessageCodec` for details on the encoding.

The encoding is extensible via subclasses overriding `writeValue`.

Definition at line 92 of file FlutterCodecs.h.

## Method Documentation

## ◆ initWithData:

- (instancetype) initWithData: |  | (NSMutableData*) | data |

Initial value:
{
NSMutableData* _data

Create a `FlutterStandardWriter` who will write to `data`.

Definition at line 206 of file FlutterStandardCodec.mm.

206 :(NSMutableData*)data {
207 self = [super init];
208 NSAssert(self, @"Super init cannot be nil");
209 _data = data;
210 return self;
211 }

## ◆ writeAlignment:

- (void) writeAlignment: |  | (UInt8) | alignment |

Write zero padding until data is aligned with `alignment`.

Definition at line 229 of file FlutterStandardCodec.mm.

229 :(UInt8)alignment {
230 FlutterStandardCodecHelperWriteAlignment((__bridge CFMutableDataRef)_data, alignment);
231 }

References FlutterStandardCodecHelperWriteAlignment().

## ◆ writeByte:

- (void) writeByte: |  | (UInt8) | value |

Write a 8-bit byte.

Definition at line 213 of file FlutterStandardCodec.mm.

213 :(UInt8)value {
214 FlutterStandardCodecHelperWriteByte((__bridge CFMutableDataRef)_data, value);
215 }

References FlutterStandardCodecHelperWriteByte().

Referenced by ExtendedWriter::writeValue:.

## ◆ writeBytes:length:

- (void) writeBytes: |  | (const void*) | bytes
length: |  | (NSUInteger) | length

Write an array of `bytes` of size `length`.

Definition at line 217 of file FlutterStandardCodec.mm.

217 :(const void*)bytes length:(NSUInteger)length {
218 FlutterStandardCodecHelperWriteBytes((__bridge CFMutableDataRef)_data, bytes, length);
219 }

References FlutterStandardCodecHelperWriteBytes().

Referenced by ExtendedWriter::writeValue:.

## ◆ writeData:

- (void) writeData: |  | (NSData*) | data |

Write an array of bytes contained in `data`.

Definition at line 221 of file FlutterStandardCodec.mm.

221 :(NSData*)data {
222 FlutterStandardCodecHelperWriteData((__bridge CFMutableDataRef)_data, (__bridge CFDataRef)data);
223 }

References FlutterStandardCodecHelperWriteData().

## ◆ writeSize:

- (void) writeSize: |  | (UInt32) | size |

Write 32-bit unsigned integer that represents a `size` of a collection.

Definition at line 225 of file FlutterStandardCodec.mm.

225 :(UInt32)size {
226 FlutterStandardCodecHelperWriteSize((__bridge CFMutableDataRef)_data, size);
227 }

References FlutterStandardCodecHelperWriteSize().

## ◆ writeUTF8:

- (void) writeUTF8: |  | (NSString*) | value |

Write a string with UTF-8 encoding.

Definition at line 233 of file FlutterStandardCodec.mm.

233 :(NSString*)value {
234 FlutterStandardCodecHelperWriteUTF8((__bridge CFMutableDataRef)_data,
235 (__bridge CFStringRef)value);
236 }

References FlutterStandardCodecHelperWriteUTF8().

## ◆ writeValue:

- (void) writeValue: |  | (id) | value |

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.

Reimplemented in ExtendedWriter.

Definition at line 347 of file FlutterStandardCodec.mm.

347 :(id)value {
348 FlutterStandardCodecObjcType type = GetWriteType(value);
349 WriteValueOfType((__bridge CFTypeRef)self, (__bridge CFMutableDataRef)self->_data, type,
350 (__bridge CFTypeRef)value);
351 }

Referenced by ExtendedWriter::writeValue:.

The documentation for this class was generated from the following files:

- shell/platform/darwin/common/framework/Headers/FlutterCodecs.h
- shell/platform/darwin/common/framework/Source/FlutterStandardCodec.mm

FlutterStandardCodecHelperWriteUTF8
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)
Definition: FlutterStandardCodecHelper.cc:211
FlutterStandardCodecHelperWriteAlignment
void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:201
FlutterStandardCodecObjcType
FlutterStandardCodecObjcType
Definition: FlutterStandardCodecHelper.h:40
FlutterStandardCodecHelperWriteSize
void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size)
Definition: FlutterStandardCodecHelper.cc:188
FlutterStandardCodecHelperWriteData
void FlutterStandardCodecHelperWriteData(CFMutableDataRef data, CFDataRef value)
Definition: FlutterStandardCodecHelper.cc:232
FlutterStandardCodecHelperWriteBytes
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
Definition: FlutterStandardCodecHelper.cc:182
FlutterStandardCodecHelperWriteByte
void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value)
Definition: FlutterStandardCodecHelper.cc:178