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,
- HeliumPaywallLoadingConfig? paywallLoadingConfig,
override
Initialize helium sdk at the start up of flutter application. It will download custom paywall view
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,
HeliumPaywallLoadingConfig? paywallLoadingConfig,
}) async {
_setMethodCallHandlers(callbacks, purchaseDelegate);
_fallbackPaywallWidget = fallbackPaywall;
if (_isInitialized) {
return "[Helium] Already initialized!";
}
_isInitialized = true;
final result = await methodChannel
.invokeMethod<String?>(initializeMethodName, {
'apiKey': apiKey,
'customUserId': customUserId,
'customAPIEndpoint': customAPIEndpoint,
'customUserTraits': _convertBooleansToMarkers(customUserTraits),
'revenueCatAppUserId': revenueCatAppUserId,
'fallbackAssetPath': fallbackBundleAssetPath,
'paywallLoadingConfig': _convertBooleansToMarkers(paywallLoadingConfig?.toMap()),
'useDefaultDelegate': purchaseDelegate == null,
});
return result;
}