BillingClientManager class

Utility class that manages a BillingClient connection.

Connection is initialized on creation of BillingClientManager. If BillingClient sends onBillingServiceDisconnected event or any operation returns BillingResponse.serviceDisconnected, connection is re-initialized.

BillingClient instance is not exposed directly. It can be accessed via runWithClient and runWithClientNonRetryable methods that handle the connection management.

Consider calling dispose after the BillingClient is no longer needed.

Constructors

BillingClientManager({@visibleForTesting BillingClientFactory? billingClientFactory})
Creates the BillingClientManager.

Properties

client BillingClient
BillingClient instance managed by this BillingClientManager.
latefinal
hashCode int
The hash code for this object.
no setterinherited
purchasesUpdatedStream Stream<PurchasesResultWrapper>
Stream of onPurchasesUpdated events from the BillingClient.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userChoiceDetailsStream Stream<UserChoiceDetailsWrapper>
Stream of userSelectedAlternativeBilling events from the BillingClient.
latefinal

Methods

dispose() → void
Ends connection to the BillingClient.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onUserChoiceAlternativeBilling(UserChoiceDetailsWrapper event) → void
Callback passed to BillingClient to use when customer chooses alternative billing.
reconnectWithBillingChoiceMode(BillingChoiceMode billingChoiceMode) Future<void>
Ends connection to BillingClient and reconnects with billingChoiceMode.
runWithClient<R extends HasBillingResponse>(Future<R> action(BillingClient client)) Future<R>
Executes the given action with access to the underlying BillingClient.
runWithClientNonRetryable<R>(Future<R> action(BillingClient client)) Future<R>
Executes the given action with access to the underlying BillingClient.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited