Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | List of all members
FlutterStandardMessageCodec Class Reference

#include <FlutterCodecs.h>

Inheritance diagram for FlutterStandardMessageCodec:
<FlutterMessageCodec>

Instance Methods

(instancetype) - initWithReaderWriter: [implementation]
 
(NSData *) - encode: [implementation]
 
(id- decode: [implementation]
 
- Instance Methods inherited from <FlutterMessageCodec>
(NSData *_Nullable) - encode:
 
(id _Nullable) - decode:
 

Class Methods

(instancetype) + codecWithReaderWriter:
 
(instancetype) + sharedInstance [implementation]
 

Detailed Description

A FlutterMessageCodec using the Flutter standard binary encoding.

This codec is guaranteed to be compatible with the corresponding StandardMessageCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

Supported messages are acyclic values of these forms:

On the Dart side, these values are represented as follows:

Definition at line 209 of file FlutterCodecs.h.

Method Documentation

◆ codecWithReaderWriter:

+ (instancetype) codecWithReaderWriter: (FlutterStandardReaderWriter*)  readerWriter

Create a FlutterStandardMessageCodec who will read and write to readerWriter.

Definition at line 8 of file FlutterStandardCodec.mm.

24 :(FlutterStandardReaderWriter*)readerWriter {
25 return [[FlutterStandardMessageCodec alloc] initWithReaderWriter:readerWriter];
26}

◆ decode:

- (id) decode: (NSData*)  message
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

45 :(NSData*)message {
46 if ([message length] == 0) {
47 return nil;
48 }
49 FlutterStandardReader* reader = [_readerWriter readerWithData:message];
50 id value = [reader readValue];
51 NSAssert(![reader hasMore], @"Corrupted standard message");
52 return value;
53}
uint8_t value
size_t length
Win32Message message

◆ encode:

- (NSData *) encode: (id message
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

35 :(id)message {
36 if (message == nil) {
37 return nil;
38 }
39 NSMutableData* data = [NSMutableData dataWithCapacity:32];
40 FlutterStandardWriter* writer = [_readerWriter writerWithData:data];
41 [writer writeValue:message];
42 return data;
43}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
const uintptr_t id

◆ initWithReaderWriter:

- (instancetype) initWithReaderWriter: (FlutterStandardReaderWriter*)  readerWriter
implementation

Definition at line 8 of file FlutterStandardCodec.mm.

28 :(FlutterStandardReaderWriter*)readerWriter {
29 self = [super init];
30 NSAssert(self, @"Super init cannot be nil");
31 _readerWriter = readerWriter;
32 return self;
33}

◆ sharedInstance

+ (instancetype) sharedInstance
implementation

Returns a shared instance of this FlutterMessageCodec.

Reimplemented from <FlutterMessageCodec>.

Definition at line 8 of file FlutterStandardCodec.mm.

15 {
16 static id _sharedInstance = nil;
17 if (!_sharedInstance) {
18 FlutterStandardReaderWriter* readerWriter = [[FlutterStandardReaderWriter alloc] init];
19 _sharedInstance = [[FlutterStandardMessageCodec alloc] initWithReaderWriter:readerWriter];
20 }
21 return _sharedInstance;
22}

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