flutter package 發(fā)布到 pub.dev 過程記錄:
前置條件
- package 代碼要上傳到 github
- 要有g(shù)oogle gmail 郵箱
滿足以上條件就可以去發(fā)布了串稀,發(fā)布前需要完善pubspec.yaml信息:
author: 昵稱 <XXXXX@gmail.com>
# homepage githup項(xiàng)目地址
homepage: https://github.com/XXX/flutter_subscreen_plugin
接下來之碗,提交,命令行執(zhí)行:
$ flutter packages pub publish --server=https://pub.dartlang.org
選擇 y送朱,點(diǎn)擊鏈接到Google進(jìn)行驗(yàn)證捺典。
出現(xiàn)報(bào)錯(cuò):
It looks like accounts.google.com is having some trouble.
網(wǎng)絡(luò)翻墻原因造成澳叉,我們在命令行輸入以下語句:
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
然后再次執(zhí)行:
flutter packages pub publish --server=https://pub.dartlang.org
終端發(fā)出報(bào)錯(cuò)信息:
LICENSE文件不能為空紊遵,我們進(jìn)行補(bǔ)充,如下:
Copyright ? 2021, llixiaohong
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
補(bǔ)充完畢汞贸,重走一遍流程命令绳军,如下所示就是成功上傳,等待那邊服務(wù)器重新更新之后(1個(gè)小時(shí)左右)就可以使用了
發(fā)布到pub上面的地址是什么呢:
#https://pub.flutter-io.cn/packages/插件名矢腻,示例
https://pub.flutter-io.cn/packages/flutter_subscreen_plugin
如果你后面維護(hù)需要升級(jí)版本號(hào)门驾,重復(fù)上面發(fā)布的操作,就可以了多柑。