flutter 开发package 发布到pub.dev

一、package分类

 

1. flutter package 纯dart包 只写flutter代码,不涉及原生

2. flutter plugin 插件包 设计原生代码

本文只讨论dart包

二、创建dart包

flutter create ---template=package packageName(名称)

三、结构

lib/xiangjbtest.dart Dart实现代码

pubspec.yaml 配置文件

CHANGELOG.md. 修改记录

LICENSE 许可证文件

README.md 描述文件 用来介绍自己的package

四、发布前的配置

pubspec.yam

name: xiangjbtest  #标题
description: 这是一个简介
version: 0.0.1  #版本
homepage: https://github.com/xxx/xxx.git  #该package对应的git地址

LICENSE文件。随便在pub.dev库里找一个复制就行

MIT License

Copyright (c) 2019 Remi Rousselet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

 

五、发布前的检查

flutter packages pub publish --dry-run

六、发布

flutter packages pub publish

"y" 继续 

不出意外下面会有一个链接 复制去浏览器登录google账号验证一下即可

最后来一张成功的照片(我这个是因为之前上传过 所以没有链接直接就成功啦) 

七、遇到的问题

1、

这个界面一直没反应了 是因为需要翻*墙 设置好之后在命令行执行(端口改成自己的)

export https_proxy=http://127.0.0.1:19180

export http_proxy=http://127.0.0.1:19180 

set https_proxy=https://127.0.0.1:19180 

set http_proxy=http://127.0.0.1:19180 

2、判断有没有外网

 这个样子是没有外网的

这个样子是有外网的

有其他问题欢迎留言讨论

 

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值