setup static method

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

Implementation

static void setup(ScreenshotFlutterApi? api,
    {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.ScreenshotFlutterApi.onTakeScreenshot', codec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      channel.setMessageHandler(null);
    } else {
      channel.setMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.ScreenshotFlutterApi.onTakeScreenshot was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final Uint8List? arg_data = (args[0] as Uint8List?);
        api.onTakeScreenshot(arg_data);
        return;
      });
    }
  }
}