# FlutterMessageCodec

Objective-C

    @protocol FlutterMessageCodec

Swift

    protocol FlutterMessageCodec

A message encoding/decoding mechanism.

- `+sharedInstance`

  Returns a shared instance of this `FlutterMessageCodec`.

  #### Declaration

  Objective-C

      + (nonnull instancetype)sharedInstance;

  Swift

      static func sharedInstance() -> Self

- `-encode:`

  Encodes the specified message into binary.

  #### Declaration

  Objective-C

      - (NSData *_Nullable)encode:(id _Nullable)message;

  Swift

      func encode(_ message: Any?) -> Data?

  #### Parameters

  `message` | The message.

  #### Return Value

  The binary encoding, or `nil`, if `message` was `nil`.

- `-decode:`

  Decodes the specified message from binary.

  #### Declaration

  Objective-C

      - (id _Nullable)decode:(NSData *_Nullable)message;

  Swift

      func decode(_ message: Data?) -> Any?

  #### Parameters

  `message` | The message.

  #### Return Value

  The decoded message, or `nil`, if `message` was `nil`.

© 2023 Flutter. All rights reserved. (Last updated: 2023-06-01)

Generated by jazzy ♪♫ v0.14.3, a Realm project.