5

假设我们创建了一个带有颤振的插件。命名为flutter_local_plugin。我们怎样才能把它放在一个flutter项目flutter_some_application中并访问它?这里有一个问题(如何在另一个flutter应用程序中使用本地flutter包?),但接受的答案对实际文件迁移有0个解释。

  • 我们只需要将插件放置在flutter_some_application中,无需包项目中的任何示例
  • 您将 .kt 和 .dart 文件放在哪里,以及如何将所有这些链接在一起?

似乎没有关于如何实现这一目标的指南。

4

1 回答 1

0

I created a flutter plugin by Android Studio 4.0 which name is printer. We can get a tip at the 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: ../

Then I use printer locally in another flutter project:

  printer:
    path: ../printer/

After pub get I found printer added in .flutter-plugins & .flutter-plugins-dependencies automatically.

于 2020-06-05T08:44:24.357 回答