项目作者: whataa

项目描述 :
A lightweight flutter plugin for WeChat / Weixin SDK.
高级语言: Java
项目地址: git://github.com/whataa/flutter_weixin_plugin.git
创建时间: 2019-05-09T10:17:01Z
项目社区:https://github.com/whataa/flutter_weixin_plugin

开源协议:Apache License 2.0

下载


A lightweight flutter plugin for WeChat SDK.

Dependencies

In your pubspec.yaml file:

  1. dependencies:
  2. flutter_weixin_plugin: ^0.0.1

Register

It’s recommended to register in runApp() :

  1. import 'package:flutter_weixin_plugin/wx_plugin.dart';
  2. WxPlugin().register("your appId", "your appSecret");

API

All APIs return Future, use then to get success callback and catchError to get failed callback.
When it fails, a PlatformException obj is returned, its code could be one of the following values:

  1. CODE_INSTALL = -1; // WeChat is not installed.
  2. CODE_FAILED = -2; // failed.
  3. CODE_DENIED = -3; // user refuses auth.
  4. CODE_CANCEL = -4; // user clicks cancel.

1. Auth(Login)

  1. WxPlugin().auth()
  2. .then((value) {
  3. print("success: $value");
  4. }).catchError((value) {
  5. print("failed: value");
  6. });

Auth returns WxAuth object.

2. Share

  1. WxPlugin().shareText(...)
  2. WxPlugin().shareImage(...)
  3. WxPlugin().shareMusic(...)
  4. WxPlugin().shareVideo(...)
  5. WxPlugin().shareUrl(...)
  6. WxPlugin().shareMiniProgram(...)

If share failed, please check com.tencent.mm.opensdk.modelmsg.WXMediaMessage#checkArgs().

3. Pay

  1. WxPlugin().pay(...)

Pay returns WxPay object.

TODO

  • plugin for iOS

LICENSE

Apache