flutter微信登录集成

  1. main.dart 初始化(fluwx: ^1.2.1+1)
void initWX() async{
    await fluwx.registerWxApi(
        appId:"xxxxxxxxxx",
        doOnAndroid: true,
        doOnIOS: true,
        universalLink:"https://www.kxxxxxxx/"

    );
    var result = await fluwx.isWeChatInstalled();
    print("is installed $result");
  }

2.登录调用

///微信登录
  void loginWX() {
    print("微信登录");
    fluwx
        .sendAuth(scope: "snsapi_userinfo", state: "wechat_sdk_demo_test")
        .then((data) {
      setState(() {
        print("拉取微信用户信息:" + data.toString());
      });
    }).catchError((e) {
      print('weChatLogin  e  $e');
    });
  }
发布了316 篇原创文章 · 获赞 63 · 访问量 37万+

猜你喜欢

转载自blog.csdn.net/ytfunnysite/article/details/104023366