registerWxApi function

Future<bool> registerWxApi({
  1. required String appId,
  2. bool doOnIOS = true,
  3. bool doOnAndroid = true,
  4. String? universalLink,
})

It's ok if you register multi times. appId is not necessary. if doOnIOS is true ,fluwx will register WXApi on iOS. if doOnAndroid is true, fluwx will register WXApi on Android. universalLink is required if you want to register on iOS.

Implementation

Future<bool> registerWxApi({
  required String appId,
  bool doOnIOS = true,
  bool doOnAndroid = true,
  String? universalLink,
}) async {
  if (doOnIOS && Platform.isIOS) {
    if (universalLink == null ||
        universalLink.trim().isEmpty ||
        !universalLink.startsWith('https')) {
      throw ArgumentError.value(
        universalLink,
        "You're trying to use illegal universal link, see "
        'https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html '
        'for more detail',
      );
    }
  }
  return await _channel.invokeMethod('registerApp', {
    'appId': appId,
    'iOS': doOnIOS,
    'android': doOnAndroid,
    'universalLink': universalLink
  });
}