When I try to run a test file that has no relevance to firebase_auth, why am I getting an error related to firebase_auth?

huangapple go评论79阅读模式
英文:

When I try to run a test file that has no relevance to firebase_auth, why am I getting an error related to firebase_auth?

问题

我已经创建了一个名为CoreLengthUnits的枚举,以及一个名为CoreLengthUnitsExtension的枚举扩展。这些组件都与Firebase服务无关。然而,我遇到了如下所示的错误。由于这个错误,我想运行的测试不起作用(测试编译失败)。可能的原因是什么?有什么想法吗?

此外,如果我直接将枚举及其扩展写入测试文件而不导入它们,然后删除导入语句,我可以运行测试文件而不遇到任何错误。然而,即使导入的文件中没有包含任何导出行,为什么我仍然会收到一个无关的错误?

英文:

I have created an enum called CoreLengthUnits along with an extension named CoreLengthUnitsExtension for this enum. Neither of these components are related to firebase services. However, I'm getting an error as shown below. Due to this error, the test I want to run is unfortunately not working(Compilation failed for test). What could be the reason? any idea?

Furthermore, if I directly write the enum and its extension into the test file instead of importing them, and then remove the imports, I can run the test file without encountering any errors. However, even though the imported files don't contains any export lines, why might I still be receiving an unrelated error?

When I try to run a test file that has no relevance to firebase_auth, why am I getting an error related to firebase_auth?

答案1

得分: 0

似乎在Flutter 3及以上版本中创建包时可能会出现问题,或者在使用新的Flutter版本测试旧包时可能会出现问题。在尝试创建一个新的包来隔离我在现有包中遇到的问题时,我在创建新包的过程中遇到了与Android嵌入v2相关的错误。

在研究过程中,我发现了一个现有的问题,链接如下:链接。如果你查看该链接,你可能会更好地理解这个问题。

实质上,似乎与Flutter-pub相关的问题。自然地,我按照以下命令使用包创建过程:

flutter create -t package test --no-pub

然后,我使用这个命令将包的依赖项和内容转移到我创建的新包中。

结果是:我现在可以编写和执行单元测试而没有任何问题。

总结一下,如果你在3.0版本之前创建了一个包,然后尝试在安装了Flutter 3.0的系统上使用它,你可能会因为包依赖项而遇到错误。你可以通过使用上述命令创建一个新的包并转移必要的文件来解决这个问题。

顺便说一下,我从这个评论中找到了这个命令:链接

英文:

It seems that there might be an issue with package creation on Flutter 3 and above, or when testing older packages with the new Flutter version. While attempting to create a new package to isolate the issues I was facing in an existing package, I encountered an error related to Android embedding v2 during the creation of the new package.

Upon researching this, I came across an existing issue at this link: link. If you take a look at the link, you might get a better understanding of the problem.

In essence, there seems to be an issue related to the Flutter-pub side of things. Naturally, I followed the package creation process using the command

flutter create -t package test --no-pub

, and I transferred the package dependencies and contents to the new one I created using this command.

The result: I can now write and execute unit tests without any issue.

To summarize, if you created a package before version 3.0 and then try to use it on a system with Flutter 3.0 installed, you might encounter errors due to package dependencies. You can overcome this problem by creating a new package using the mentioned command and transferring the necessary files.

By the way, I found the command from this comment: link.

huangapple
  • 本文由 发表于 2023年8月9日 07:36:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76863731.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定