googleads-mobile-flutter icon indicating copy to clipboard operation
googleads-mobile-flutter copied to clipboard

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

Open Reprevise opened this issue 1 year ago • 5 comments

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.

Reprevise avatar May 23 '23 19:05 Reprevise

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

huycozy avatar Jul 21 '23 11:07 huycozy

@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.

Reprevise avatar Nov 02 '23 17:11 Reprevise

Yes. Re-opening the issue for further updates.

huycozy avatar Nov 03 '23 03:11 huycozy

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

malandr2 avatar Apr 25 '24 18:04 malandr2

@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.

Reprevise avatar Apr 25 '24 18:04 Reprevise