简体   繁体   English

如何测试flutter包的工作?

[英]How to test the working of flutter package?

What would be the best practice to test the working of flutter package?测试颤振包工作的最佳实践是什么?

Recently I developed a Flutter package and I am testing its functionality by creating another flutter application and importing it to there, in this way I have to deal with two projects.最近我开发了一个 Flutter 包,我正在通过创建另一个 Flutter 应用程序并将其导入到那里来测试它的功能,这样我必须处理两个项目。 Is there any method to do all it in the same project like android native development?有没有什么方法可以像android原生开发一样在同一个项目中完成所有这些?

example/ directory contains only example.dart which is not runable? example/目录仅包含不可运行的 example.dart? Any suggestion ?有什么建议吗?

Answer based off of Shahzad's flutter_tex package , and thanks to Remi's suggestion.答案基于 Shahzad 的flutter_tex 包,并感谢 Remi 的建议。

As mentioned, one way to test a package in Flutter is to create a Flutter app within the "Example" directory.如前所述,在 Flutter 中测试包的一种方法是在“示例”目录中创建一个 Flutter 应用程序。 In this app, list the following in the pubspec.yaml file:在此应用程序中,在 pubspec.yaml 文件中列出以下内容:

dependencies:
  flutter:
    sdk: flutter
  your_package_name:
    path: ../

As shown, you specify your package's path, which is the level above the "Example" folder the test app resides in.如图所示,您指定包的路径,它是测试应用程序所在的“示例”文件夹上方的级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM