start static method
Start Iaphub
Implementation
static Future<void> start(
{String appId = "",
String apiKey = "",
String? userId,
bool allowAnonymousPurchase = false,
bool enableStorekitV2 = false,
String lang = '',
String environment = 'production'}) async {
// Clear listeners
removeAllListeners();
// Add channel call handler
_channel.setMethodCallHandler(_invokeListener);
// Invoke start
const sdkVersion = IaphubConfig.version;
await _invokeMethod('start', {
"appId": appId,
"apiKey": apiKey,
"userId": userId,
"allowAnonymousPurchase": allowAnonymousPurchase,
"enableStorekitV2": enableStorekitV2,
"lang": lang,
"environment": environment,
"sdkVersion": sdkVersion
});
// Display product missing error
addEventListener("onError", (err) {
if (err.code == "unexpected" &&
err.subcode == "product_missing_from_store") {
debugPrint(err.message);
}
});
}