googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
340 stars 283 forks source link

[UMP] Convert to Future-based API instead of callbacks #852

Open Reprevise opened 1 year ago

Reprevise commented 1 year ago

Use case

Currently, I'm using Completers to get close to resembling a Future-based API but this should really be converted to using Futures. Success/failure callbacks are very java-y and don't work well in Dart.

Proposal

A new package hit stable called flutter_funding_choices and I believe great inspiration can be taken from that.

ConsentForm#loadConsentForm return type should be a Future<ConsentForm> which throws an error. I understand the attempt to force the user to handle the FormError but I believe this is more of a language problem and not having a Result type class to handle success/error states.

ConsentInformation#requestConsentInfoUpdate return type should be Future<ConsentStatus> and should throw an exception (maybe a GoogleMobileAds specific exception like a new GoogleMobileAdsException class?).

ConsentForm#show should drop the onConsentFormDismissedListener param as well, and should just throw an exception. If you want users to be able to wait for the form to be dismissed, perhaps make it a Future<void> return type.

huycozy commented 1 year ago

We’re closing this issue due to inactivity. If you’re still impacted, please create a new issue via the Developer Forum.

Reprevise commented 11 months ago

@huycozy Can this issue be re-opened? I created a post on the forum on July 21st and haven't gotten a response, and my other feature request issue is open.

huycozy commented 11 months ago

Yes. Re-opening the issue for further updates.

malandr2 commented 5 months ago

@Reprevise take a look at https://github.com/googleads/googleads-mobile-flutter/issues/852 and feel free to leave any comments

Reprevise commented 5 months ago

@Reprevise take a look at #852 and feel free to leave any comments

I'd love to see an update to the requestConsentInfoUpdate method and to the loadConsentForm method (regardless of the new consent form method introduced in that PR) but I do recognize they would be breaking changes.