firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

Incorrect documentation for RewardedVideoAd (Syntax error) #538

Closed kroikie closed 4 years ago

kroikie commented 5 years ago

I am using firebase_admob for showing ads, both banner and interstitial worked but when I was implementing the RewardedVideoAds, I got syntax error.

Code (From Docs)

RewardedVideoAd.instance.listener =
    (RewardedVideoAdEvent event, [String rewardType, int rewardAmount]) {
  if (event == RewardedVideoAdEvent.rewarded) {
    setState(() {
      // Here, apps should update state to reflect the reward.
      _goldCoins += rewardAmount;
    });
  }
};

Code (My own)

This minimises above code to reflect the error. (Both code shows syntax error)

void loadVideoAd() {
  RewardedVideoAd.instance.listener = (RewardedVideoAdEvent event, [String rewardType, int rewardAmount]) {
    if (event == RewardedVideoAdEvent.rewarded) {}
  };
}

Syntax Error

A value of type (RewardedVideoAdEvent, [String, int]) -> Null can't be assigned to a variable of type (RewardedVideoAdEvent, {rewardType: String, rewardAmount: int}) -> void

screenshot 2018-12-17 at 9 45 08 pm

Feedback

The documentation for RewardedVideoAd is very poor. They also have syntax error. Probably the docs have not been updated since long.

kroikie commented 5 years ago

@dark-chocolate

The issue at https://github.com/flutter/flutter/issues/25464 has been closed and moved here. Future collaboration on this issue will be done here.

iapicca commented 5 years ago

Hi @dark-chocolate If you are still experiencing this issue with the latest version of Flutter and FlutterFire plugin can you please provide your updated flutter doctor -v and your and your flutter run --verbose/flutter build --verbose ? Also, to better address the issue, would be helpful if you could post a self contained app on github or the steps to reproduce it. Thank you

dark-chocolate commented 5 years ago

@iapicca The issue has been solved, please close it.

iapicca commented 4 years ago

Hi @dark-chocolate given your last message I feel safe to close this issue, if you disagree please write in the comments and I will reopen it. Thank you