openURL method

Future<void> openURL({
  1. required String url,
  2. String? wechatRedirectURI,
})

Implementation

Future<void> openURL({
  required String url,
  String? wechatRedirectURI,
}) async {
  final refreshToken = _refreshToken;
  if (refreshToken == null) {
    throw Exception("openURL requires authenticated user");
  }

  final targetURL = await internalGenerateURL(
    redirectURI: url,
    wechatRedirectURI: wechatRedirectURI,
  );

  if (wechatRedirectURI != null) {
    await native.registerWechatRedirectURI(
        onWechatRedirectURI: _onWechatRedirectURI,
        wechatRedirectURI: wechatRedirectURI);
  }

  await native.openURL(
    url: targetURL.toString(),
  );
}