A codec for method calls and enveloped results.
Method calls are encoded as binary messages with enough structure that the
codec can extract a method name
NSString and an arguments
nil. These data items are used to populate a
Result envelopes are encoded as binary messages with enough structure that
the codec can determine whether the result was successful or an error. In
the former case, the codec can extract the result
In the latter case, the codec can extract an error code
NSString error message (possibly
nil), and a custom
nil. These data items are used to
Provides access to a shared instance this codec.
+ (nonnull instancetype)sharedInstance;
The shared instance.
Encodes the specified successful result into binary.
- (nonnull NSData *)encodeSuccessEnvelope:(id _Nullable)result;
The result. Must be a value supported by this codec.
The binary encoding.
Deccodes the specified result envelope from binary.
- (id _Nullable)decodeEnvelope:(nonnull NSData *)envelope;
The error object.
The result value, if the envelope represented a successful result, or a
FlutterErrorinstance, if not.