startConnection method
Future<BillingResultWrapper>
startConnection({
- required OnBillingServiceDisconnected onBillingServiceDisconnected,
- BillingChoiceMode billingChoiceMode = BillingChoiceMode.playBillingOnly,
Calls
BillingClient#startConnection(BillingClientStateListener)
to create and connect a BillingClient
instance.
onBillingServiceConnected
has been converted from a callback parameter
to the Future result returned by this function. This returns the
BillingClient.BillingResultWrapper
describing the connection result.
This triggers the creation of a new BillingClient
instance in Java if
one doesn't already exist.
Implementation
Future<BillingResultWrapper> startConnection(
{required OnBillingServiceDisconnected onBillingServiceDisconnected,
BillingChoiceMode billingChoiceMode =
BillingChoiceMode.playBillingOnly}) async {
hostCallbackHandler.disconnectCallbacks.add(onBillingServiceDisconnected);
return resultWrapperFromPlatform(await _hostApi.startConnection(
hostCallbackHandler.disconnectCallbacks.length - 1,
platformBillingChoiceMode(billingChoiceMode)));
}