此问题的解答见:
把本地package 根目录和 app的根目录并列,然后在 app的 .yaml 文件加:
1 2 3 4 5 6 |
dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 #This is an asset repo containing the default set of icon assets used by Flutter's Cupertino widgets <span style="color: #ff0000;"> paowuxiangame: path: ../paowuxiangame</span> |
红字部分即为本地package
,当需要使用时: 引用方法为:
1 |
import 'package:paowuxiangame/paowuxiangame.dart'; |
未解决问题: package 的assets无法在app使用
如何创建一个package:
1 |
flutter create --template=package hello |
官方教程: https://flutter.dev/docs/development/packages-and-plugins/developing-packages
medium 教程: https://medium.com/flutterdevs/developing-packages-in-flutter-61a31acf616d
plugin是处理平台相关的特殊package
package 是否可以带ui? 可以