init method

  1. @override
Future<void> init(
  1. String apiKey,
  2. String apiSecret,
  3. WanUser user, {
  4. WanSetting? setting,
})
override

Implementation

@override
Future<void> init(String apiKey, String apiSecret, WanUser user,  {WanSetting? setting}) async{
  Map<String, dynamic> userDict = {
    "id": user.id,
    "age": user.age,
    "gender": user.gender?.index.toString(),
    "subId2": user.subId2
  };
  Map<String, dynamic>? settingDict = setting != null ? {
    "primaryColor" : setting.primaryColor != null ? "#${setting.primaryColor.toString().substring(4) }" : null,
    "confirmButtonColor": setting.confirmButtonColor != null ? "#${setting.confirmButtonColor.toString().substring(4) }" : null

  } : null;

  final status = await methodChannel.invokeMethod<bool>('init', {
    "apiKey": apiKey,
    "apiSecret": apiSecret,
    "user": userDict,
    "setting": settingDict
  });
}