问题描述
我想知道如何从第三方导入新软件包并在我的代码中调用它?
您可以在
然后,您只需要将此句子复制到您的 pubspec.yaml
文件中即可.
pubspec.yaml
中的 dependencies
下的粘贴行.请注意,空格非常重要,因此在粘贴时,空格应在 flutter:
下开始.
将更改保存在 pubspec.yaml
中,它将自动安装软件包.如果未安装,请从命令行运行 flutter pub get
手动安装软件包.
最后,请不要忘记使用此处提供的以下行将库导入文件顶部:
I will like to know how to import a new package from third party in flutter and call it in my code?
You can find a lot of packages on Pub.dev.
To import it just open any package and navigate to the Installing
Tab.
Then you just need to copy this sentence to your pubspec.yaml
file.
Paste line under dependencies
in pubspec.yaml
. Note that spaces is very important so make it start just under flutter:
when pasting.
Save changes in pubspec.yaml
and it will install the packages automatically. If it doesn't install run flutter pub get
from command line to install the package manually.
Lastly do not forget to import the library at the top of the file by using the line provided here:
这篇关于如何在flutter中导入和使用软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!