setup static method

void setup(
  1. TestMicrophoneApi? api
)

Implementation

static void setup(TestMicrophoneApi? api) {
  {
    const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.MicrophoneApi.create', StandardMessageCodec());
    if (api == null) {
      channel.setMockMessageHandler(null);
    } else {
      channel.setMockMessageHandler((Object? message) async {
        // ignore message
        final IdMessage output = api.create();
        return <Object?, Object?>{'result': output.encode()};
      });
    }
  }
  {
    const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.MicrophoneApi.start', StandardMessageCodec());
    if (api == null) {
      channel.setMockMessageHandler(null);
    } else {
      channel.setMockMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.MicrophoneApi.start was null. Expected IdMessage.');
        final IdMessage input = IdMessage.decode(message!);
        api.start(input);
        return <Object?, Object?>{};
      });
    }
  }
  {
    const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.MicrophoneApi.stop', StandardMessageCodec());
    if (api == null) {
      channel.setMockMessageHandler(null);
    } else {
      channel.setMockMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.MicrophoneApi.stop was null. Expected IdMessage.');
        final IdMessage input = IdMessage.decode(message!);
        final RecordingMessage output = api.stop(input);
        return <Object?, Object?>{'result': output.encode()};
      });
    }
  }
  {
    const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.MicrophoneApi.dispose', StandardMessageCodec());
    if (api == null) {
      channel.setMockMessageHandler(null);
    } else {
      channel.setMockMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.MicrophoneApi.dispose was null. Expected IdMessage.');
        final IdMessage input = IdMessage.decode(message!);
        api.dispose(input);
        return <Object?, Object?>{};
      });
    }
  }
}