setCallbacks method

  1. @override
Future<void> setCallbacks({
  1. ConsentCallback? onOpen,
  2. ConsentCallback? onClose,
  3. ConsentCallback? onNotOpened,
  4. ConsentErrorCallback? onError,
  5. ConsentButtonClickedCallback? onButtonClicked,
})
override

Sets up callbacks for consent events.

Implementation

@override
Future<void> setCallbacks({
  ConsentCallback? onOpen,
  ConsentCallback? onClose,
  ConsentCallback? onNotOpened,
  ConsentErrorCallback? onError,
  ConsentButtonClickedCallback? onButtonClicked,
}) async {
  this.onOpen = onOpen;
  this.onClose = onClose;
  this.onNotOpened = onNotOpened;
  this.onError = onError;
  this.onButtonClicked = onButtonClicked;

  // Notify native side to set up callbacks
  methodChannel.setMethodCallHandler(_handleMethodCall);
  await methodChannel.invokeMethod('setCallbacks');
}