由於Flutter正式版的釋出,Flutter在國內也變得火熱起來。突然心血來潮的想寫個Plugin,跟個風蹭一蹭Flutter的熱度,但是奈何國內的一些環境,一直卡在釋出這一步。幾經周折,最後終於釋出成功了!
過程如下:
1.補全配置
首先配置 pubspec.yaml,可以根據需要,將pubspec補全:
description: Flutter Easemob SDK
version: 0.0.1
author: kayshen <kayshen_xu@163.com>
homepage: https://github.com/Kayshenxu/hyphenate_plugin
複製程式碼
注* 釋出到 Pub上在根目錄需要包含一個LICENSE
2.檢查錯誤
執行 flutter packages pub publish --dry-run
根據提示修改至終端顯示Package has 0 warnings.
3.釋出Plugin
首先需要根據自己的代理工具給終端設定代理:
export http_proxy=http://127.0.0.1:1087;
export https_proxy=http://127.0.0.1:1087;
複製程式碼
然後執行flutter packages pub publish
第一次釋出會出現以下授權介面,複製連結到瀏覽器授權即可:
Looks great! Are you ready to upload your package (y/n)? y
Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?*******userinfo.email
Then click "Allow access".
複製程式碼
注*
- 使用ss給終端設定代理時一定不要用sock5協議,不然就會出現
Invalid request method
- 如果按照官網推薦設定了:
一定要在上傳前註釋掉,不然會出現export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 複製程式碼
pub finished with exit code 1