Den*_*nko 8 flutter flutter-plugin
假设我们已经创建了一个 flutter 插件。命名为flutter_local_plugin。我们如何将其放入flutter项目flutter_some_application中并访问它?这里有一个问题(how to use local flutter package in another flutter application?),但接受的答案对实际文件迁移有 0 个解释。
似乎没有关于如何实现这一目标的指南。
我用Android Studio 4.0创建了一个flutter插件,名字是printer。我们可以在 pubspec.yaml 中获得提示:
printer:
# When depending on this package from a real application you should use:
# printer: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
Run Code Online (Sandbox Code Playgroud)
然后我在另一个 flutter 项目中本地使用打印机:
printer:
path: ../printer/
Run Code Online (Sandbox Code Playgroud)
pub get 后,我发现打印机自动添加到 .flutter-plugins 和 .flutter-plugins-dependency 中。
| 归档时间: |
|
| 查看次数: |
3897 次 |
| 最近记录: |