init method Null safety
Initializes Firework SDK.
userId
is used to uniquely identify device or user.
adConfig
is the configuration of Advertisement.
Implementation
void init({
String? userId,
AdConfig? adConfig,
}) {
final nativeMethodName =
FWMethodNameUtil.convertToNativeMethod(FWNativeMethodName.init);
Map<String, dynamic> arg = {};
if (userId != null) {
arg["userId"] = userId;
}
if (adConfig != null) {
arg["adConfig"] = AdConfigUtil.toJson(adConfig);
}
FWMethodChannelUtil.getFirewokSDKChannel()
.invokeMethod(nativeMethodName, arg);
final shoppingInitNativeMethodName =
FWShoppingMethodNameUtil.convertToNativeMethod(
FWShoppingNativeMethodName.init,
);
FWMethodChannelUtil.getShoppingChannel().invokeMethod(
shoppingInitNativeMethodName,
);
}