Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | List of all members
FlutterStringCodec Class Reference

#import <FlutterCodecs.h>

Inheritance diagram for FlutterStringCodec:
<FlutterMessageCodec>

Instance Methods

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

Class Methods

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

Detailed Description

A FlutterMessageCodec using UTF-8 encoded NSString messages.

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

Definition at line 63 of file FlutterCodecs.h.

Method Documentation

◆ decode:

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

Definition at line 9 of file FlutterCodecs.mm.

49 :(NSData*)message {
50 if (message == nil) {
51 return nil;
52 }
53 return [[NSString alloc] initWithData:message encoding:NSUTF8StringEncoding];
54}
Win32Message message

◆ encode:

- (NSData *) encode: (id message
implementation

Definition at line 9 of file FlutterCodecs.mm.

39 :(id)message {
40 if (message == nil) {
41 return nil;
42 }
43 NSAssert([message isKindOfClass:[NSString class]], @"");
44 NSString* stringMessage = message;
45 const char* utf8 = stringMessage.UTF8String;
46 return [NSData dataWithBytes:utf8 length:strlen(utf8)];
47}
const uintptr_t id

◆ sharedInstance

+ (instancetype) sharedInstance
implementation

Returns a shared instance of this FlutterMessageCodec.

Reimplemented from <FlutterMessageCodec>.

Definition at line 9 of file FlutterCodecs.mm.

31 {
32 static id _sharedInstance = nil;
33 if (!_sharedInstance) {
34 _sharedInstance = [[FlutterStringCodec alloc] init];
35 }
36 return _sharedInstance;
37}

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