initialize method
Future<String?>
initialize({
- required String apiKey,
- HeliumCallbacks? callbacks,
- HeliumPurchaseDelegate? purchaseDelegate,
- Widget? fallbackPaywall,
- String? customAPIEndpoint,
- String? customUserId,
- Map<
String, dynamic> ? customUserTraits, - String? revenueCatAppUserId,
- String? fallbackBundleAssetPath,
- HeliumEnvironment? environment,
- HeliumPaywallLoadingConfig? paywallLoadingConfig,
- Set<
String> ? androidConsumableProductIds,
override
Initialize helium sdk at the start-up of your flutter application.
Implementation
@override
Future<String?> initialize({
required String apiKey,
HeliumCallbacks? callbacks,
HeliumPurchaseDelegate? purchaseDelegate,
Widget? fallbackPaywall,
String? customAPIEndpoint,
String? customUserId,
Map<String, dynamic>? customUserTraits,
String? revenueCatAppUserId,
String? fallbackBundleAssetPath,
HeliumEnvironment? environment,
HeliumPaywallLoadingConfig? paywallLoadingConfig,
Set<String>? androidConsumableProductIds,
}) async {
_setMethodCallHandlers(callbacks, purchaseDelegate);
_fallbackPaywallWidget = fallbackPaywall;
if (_isInitialized) {
return "[Helium] Already initialized!";
}
_isInitialized = true;
try {
final result =
await methodChannel.invokeMethod<String?>(initializeMethodName,
_buildNativeArgs(
apiKey: apiKey,
purchaseDelegate: purchaseDelegate,
customAPIEndpoint: customAPIEndpoint,
customUserId: customUserId,
customUserTraits: customUserTraits,
revenueCatAppUserId: revenueCatAppUserId,
fallbackBundleAssetPath: fallbackBundleAssetPath,
environment: environment,
paywallLoadingConfig: paywallLoadingConfig,
androidConsumableProductIds: androidConsumableProductIds,
));
return result;
} catch (e) {
_isInitialized = false;
rethrow;
}
}