{"id":32286425,"url":"https://github.com/pj0579/flutter_wechat","last_synced_at":"2026-03-10T14:30:55.196Z","repository":{"id":56830516,"uuid":"130013411","full_name":"pj0579/flutter_wechat","owner":"pj0579","description":"flutter wechat","archived":false,"fork":false,"pushed_at":"2018-08-31T09:09:07.000Z","size":112,"stargazers_count":76,"open_issues_count":0,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-23T02:01:59.746Z","etag":null,"topics":["dart","flutter","flutter-plugin","wechat"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pj0579.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-18T06:19:03.000Z","updated_at":"2021-12-02T03:16:09.000Z","dependencies_parsed_at":"2022-09-09T17:31:11.070Z","dependency_job_id":null,"html_url":"https://github.com/pj0579/flutter_wechat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pj0579/flutter_wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pj0579%2Fflutter_wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pj0579%2Fflutter_wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pj0579%2Fflutter_wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pj0579%2Fflutter_wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pj0579","download_url":"https://codeload.github.com/pj0579/flutter_wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pj0579%2Fflutter_wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30337170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T12:41:07.687Z","status":"ssl_error","status_checked_at":"2026-03-10T12:41:06.728Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","flutter-plugin","wechat"],"created_at":"2025-10-23T02:00:44.121Z","updated_at":"2026-03-10T14:30:55.182Z","avatar_url":"https://github.com/pj0579.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_wechat\n\nA  flutter plugin to use wechat.\n测试使用暂时不维护了 有需要的请使用 https://github.com/OpenFlutter/fluwx\n## Features\n- [X]  Add Login\n- [X]  Add Pay\n- [ ]  Support LocalImage\n- [ ]  Support 分享小程序\n## Install\nAdd this to your package's pubspec.yaml file:\n```\ndependencies:\n  flutter_wechat: \"^0.1.5\"\n ```\n## Getting Started\n\n* Android\n   * For Android, you must do the following before you can use the plugin:\n     Add the permissions to your `AndroidManifest.xml`\n      ```\n       \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n       \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n       \u003cuses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" /\u003e\n       \u003cuses-permission android:name=\"android.permission.READ_PHONE_STATE\" /\u003e\n       \u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u003e\n       \u003cuses-permission android:name=\"android.permission.WRITE_SETTINGS\" /\u003e\n      ```\n      如果想要响应微信分享登录resp需要在mainActivity同级目录下创建wxapi文件夹\n      下面新建WXEntryACtivity集成Activity(需要在`AndroidManifest.xml`注册）\n```\n    \u003cactivity android:name=\".wxapi.WXEntryActivity\" android:exported=\"true\" android:launchMode=\"singleTop\"/\u003e\n```\n\n```\n    private IWXAPI api;\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        api = WXAPIFactory.createWXAPI(this, \"wxb25d3dec3db1affc\", false);\n        onNewIntent(getIntent());\n        finish();\n    }\n\n        @Override\n    public void onReq(BaseReq baseReq) {\n\n    }\n\n    @Override\n    public void onResp(BaseResp baseResp) {\n        sendBroadcastToWechat(baseResp);\n    }\n\n    private void sendBroadcastToWechat(BaseResp baseResp) {\n        Intent intent = new Intent();\n        intent.setAction(\"sendResp\");\n        if (baseResp instanceof SendAuth.Resp) {\n            SendAuth.Resp resp = (SendAuth.Resp) (baseResp);\n            intent.putExtra(\"code\", resp.errCode == 0 ? resp.code : \"-1\");\n            intent.putExtra(\"type\", \"SendAuthResp\");\n            sendBroadcast(intent);\n        } else {\n            intent.setAction(\"sendResp\");\n            intent.putExtra(\"code\", baseResp.errCode + \"\");\n            intent.putExtra(\"type\", \"ShareResp\");\n            sendBroadcast(intent);\n        }\n    }\n    protected void onNewIntent(Intent intent) {\n        api.handleIntent(intent, this);\n    }\n ```\n 如果想要响应微信支付resp需要在mainActivity同级目录下创建wxapi文件夹(需要在`AndroidManifest.xml`注册）\n \n    \u003cactivity\n      android:name=\".wxapi.WXPayEntryActivity\"\n      android:exported=\"true\"\n      android:launchMode=\"singleTop\"\u003e\n\n      \u003cintent-filter\u003e\n          \u003caction android:name=\"android.intent.action.VIEW\"/\u003e\n          \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n          \u003cdata android:scheme=\"your AppId\"/\u003e\n      \u003c/intent-filter\u003e\n    \u003c/activity\u003e\n \n      下面新建WXEntryACtivity集成Activity\n ```\n public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {\n\n\n    private IWXAPI api;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        api = WXAPIFactory.createWXAPI(this, \"wxb25d3dec3db1affc\", false);\n        onNewIntent(getIntent());\n        finish();\n    }\n\n    @Override\n    public void onReq(BaseReq baseReq) {\n\n    }\n\n    @Override\n    public void onResp(BaseResp baseResp) {\n        sendBroadcastToWechat(baseResp);\n    }\n\n    private void sendBroadcastToWechat(BaseResp baseResp) {\n        Intent intent = new Intent();\n        intent.setAction(\"sendResp\");\n        intent.putExtra(\"code\", baseResp.errCode + \"\");\n        intent.putExtra(\"type\", \"PayResp\");\n        sendBroadcast(intent);\n    }\n\n    protected void onNewIntent(Intent intent) {\n        api.handleIntent(intent, this);\n    }\n\n\n}\n```\n* IOS\n    * add a wechat key.\n        在Xcode中，选择你的工程设置项，选中“TARGETS”一栏，在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id\n        参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\u0026t=resource/res_list\u0026verify=1\u0026id=1417694084\u0026token=\u0026lang=zh_CN\n\u003cbr/\u003e \u003cbr/\u003e\n    * 重写项目的AppDelegate的handleOpenURL和openURL方法         \n```        \n// ios 8.x or older\n- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url\n  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation\n{\n     NSString * urlStr = [url absoluteString];\n    [[NSNotificationCenter defaultCenter]\n     postNotificationName:@\"WeChat\" object:nil userInfo:@{@\"url\":urlStr}];\n    return YES;\n}\n```\n```\n// ios 9.0+\n- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url\n            options:(NSDictionary\u003cNSString*, id\u003e *)options\n{\n    NSString * urlStr = [url absoluteString];\n    [[NSNotificationCenter defaultCenter]\n     postNotificationName:@\"WeChat\" object:nil userInfo:@{@\"url\":urlStr}];\n    return YES;\n}\n```\n         \n## How to use\n```\nimport 'package:flutter_wechat/flutter_wechat.dart';\n```\n```\n      分享返回错误码 0为正确 -1 -2 -3- 4- 5\n      登录成功返回 access_code 登录错误返回 -1\n      支付成功返回 0为正确  -1 -2\n``` \n```\n注册\nawait FlutterWechat.registerWechat(\"wxxxxxx\").then((state){print(state)});// 微信注册需要在你需要的地方注册，最好是app首页\n分享\nawait FlutterWechat.shareText(text: \"test\", type:0,).then((state){print(state)});//文字分享 type 0 聊天页面 1 朋友圈\nawait FlutterWechat.shareImage(imgUrl: \"xxx\", type:0,).then((state){print(state)});\nawait FlutterWechat.shareMusic(imgUrl: \"xxx\", musicUrl:\"\",title:\"\",description:\"\",musicDataUrl:\"\",musicLowBandDataUrl:\"\",musicLowBandUrl:\"\",type:0,).then((state){print(state)});\nawait FlutterWechat.shareVideo(imgUrl: \"xxx\", videoUrl:\"\",title:\"\",description:\"\",videoLowBandUrl:\"\",type:0,).then((state){print(state)});\nawait FlutterWechat.shareWebPage(imgUrl: \"xxx\", webpageUrl:\"\",title:\"\",description:\"\",type:0,).then((state){print(state)});\n登录\nawait FlutterWechat.login(scope:\"\",state:\"\").then((state){print(state)});\n支付\nawait FlutterWechat.pay(partnerId: \"\",prepayId: \"\",nonceStr: \"\",timeStamp: \"\",sign: \"\",package: \"\",appId: \"\",).then((state){print(state)});//具体参考微信参数传递\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpj0579%2Fflutter_wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpj0579%2Fflutter_wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpj0579%2Fflutter_wechat/lists"}