showRewardAd static method

Future<bool> showRewardAd({
  1. required String rewardId,
  2. GromoreRewardCallback? callback,
})

展示激励广告 返回值表示是否展示成功 若需验证是否有效发放奖励,请在GromoreRewardCallback中传入onRewardVerify回调

Implementation

static Future<bool> showRewardAd(
    {required String rewardId, GromoreRewardCallback? callback}) async {
  assert(isInit);

  assert(rewardId.isNotEmpty);

  try {
    if (callback != null) {
      GromoreMethodChannelHandler<GromoreRewardCallback>.register(
          "${FlutterGromoreConstants.rewardTypeId}/$rewardId", callback);
    }

    return await _methodChannel
        .invokeMethod("showRewardAd", {"rewardId": rewardId});
  } catch (_) {
    return false;
  }
}