gpt4 book ai didi

flutter - 共享来自软件包波动的依赖性

转载 作者:行者123 更新时间:2023-12-03 03:32:37 24 4
gpt4 key购买 nike

我正在开发一个flutter库包。在此程序包中,我使用了其他一些依赖项,例如,像这样的url_launcher:

 dependencies:
flutter:
sdk: flutter
url_launcher: ^5.5.0
当我将包导入flutter应用程序时,我无法在代码中引用 url_launcher,除非将其添加到应用程序 pubspec.yaml依赖项中
我想知道有什么方法可以共享从我的库包中导入的依赖项,这样就无需在应用程序中再次导入?

最佳答案

我猜,目前没有指定的方法可以做到这一点。举个例子,我将选择这个名为Chewie的包。什么是:

It sits on top of a plugin called video_player, and added some cool controller.


记录:由于它广泛使用 video_player来提供更好的 Controller ,但是, 仍然需要在应用程序中导入 video_player。否则,您的应用将崩溃。
您可以做什么?

You can mention in your documentation stating about having that dependency in the project, like the chewie plugin does. This will help people know about those things before hand, and I am sure, if your plugin is great [which is, IT SAVES TIME], people won't mind adding just another single line in their pubspec.yaml file. Otherwise, they would have done it via url_launcher but they can't. Hahaha!


猜猜这将使您更加清晰。
另外,请阅读此 Developing Packages

关于flutter - 共享来自软件包波动的依赖性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63056817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com