Flutter开发package(Dart包)

2020-06-02  本文已影响0人  fanren

一、创建package

export 'Env/DataDecoder.dart';
export 'Env/ServiceConfig.dart';
dependencies:
  flutter:
    sdk: flutter
  dio: ^2.1.13
  json_annotation: ^2.0.0

二、发布package

name: crud_service
description: A new Flutter package project.
version: 0.0.2
homepage: https://github.com/fanren5119/flutterCrud

此处不需要author一栏,会报错;

cd crud_service
flutter packages pub publish --dry-run
flutter packages pub publish

发布到pub上需要访问google账号登录;

三、发布问题

export http_proxy="http://127.0.0.1:1087"
export https_proxy="http://127.0.0.1:1087"

注意一点在Terminal 的生命周期中这个全局代理是有用的,一旦关闭了当前的Terminal,或者重新开一个那么就要重新运行上面的命令了
这里的ip与端口需要在Shadowssocks的设置中查看;

// 删除这两行
export PUB_HOSTED_URL=https://pub.flutter-io.cn 
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

刷新终端口:source ~/.bash_profile
或可使用unset FLUTTER_STORAGE_BASE_URL;unset PUB_HOSTED_URL 临时使上述两行失效;
发布成功之后,要改回来,不然android studio里会获取不到;

## [0.0.1] - TODO: Add release date.
## [0.0.2] - TODO: add export file
上一篇下一篇

猜你喜欢

热点阅读