AdInstanceManager constructor

AdInstanceManager(
  1. String channelName
)

Implementation

AdInstanceManager(String channelName)
    : channel = MethodChannel(
        channelName,
      ) {
  channel.setMethodCallHandler((MethodCall call) async {
    assert(call.method == 'onAdEvent');

    final int adId = call.arguments['adId'];
    final String eventName = call.arguments['eventName'];

    final Ad? ad = adFor(adId);
    if (ad != null) {
      _onAdEvent(ad, eventName, call.arguments);
    } else {
      debugPrint('$Ad with id `$adId` is not available for $eventName.');
    }
  });
}