一、flutter有三种模板
Flutter Application: Flutter应用
Flutter Plugin:Flutter插件
Flutter Package:纯Dart组件
二:创建
1、如果开发是有flutter代码的公共组件,则用Flutter Plugin
flutter create --org com.example --plugin commonplugin
com.example:换成你自己的域名
commonplugin :换成你要创建的组件名
2、如果是开发纯的dart功能组件则:
flutter create --template=package hello
hello是要创建的组件名,创建成功后可在lib目录下写公共的dart代码
三、调用
他项目调用时有三种方式:
1:pubspec.yaml文件中通过相对路劲引用:
dependencies:
testcommon:
path: ../testcommon/
2:放到git上,引用git地址
dependencies:
dartcommon:
git:
url:git://github.com/******
ref:master
3:发布到https://pub.dev/上:
这个我没试过,不过网上有教程