setup static method

void setup(
  1. MainHandler? api, {
  2. BinaryMessenger? binaryMessenger,
})

Implementation

static void setup(MainHandler? api, {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.MainHandler.handler', codec, binaryMessenger: binaryMessenger);
    if (api == null) {
      channel.setMessageHandler(null);
    } else {
      channel.setMessageHandler((Object? message) async {
        assert(message != null, 'Argument for dev.flutter.pigeon.MainHandler.handler was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final Map<Object?, Object?>? arg_message = (args[0] as Map<Object?, Object?>?);
        assert(arg_message != null, 'Argument for dev.flutter.pigeon.MainHandler.handler was null, expected non-null Map<Object?, Object?>.');
        final Map<Object?, Object?> output = await api.handler(arg_message!);
        return output;
      });
    }
  }
}