在Flutter中有两个文件引用,文件名相同但大小写不同。

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

There is two file import in flutter with same file name but different case

问题

Picture shown that two imports exists.../SignUp_repo.dart and ../signup_repo.dart.

I have tried flutter clean and flutter pub get but still got the same issue. If I import between both, only one import will work (The one with uppercase file name import).

Hope anyone can help me to solve this issue. Thanks!

英文:

在Flutter中有两个文件引用,文件名相同但大小写不同。
Picture shown that two imports exists.../SignUp_repo.dart and ../signup_repo.dart.

I have tried flutter clean and flutter pub get but still got the same issue. If I import between both, only one import will work (The one with uppercase file name import).

Hope anyone can help me to solve this issue. Thanks!

答案1

得分: 3

你可以在导入时使用 as 前缀。

import '../SignUp/domain/repositories/SignUp_repo.dart' as signUp

然后可以这样使用 signUp.SignUpRepo。你也可以对另一个做同样的操作。

英文:

You can use the as prefix while importing.

import '../SignUp/domain/repositories/SignUp_repo.dart' as signUp

And use it like signUp.SignUpRepo. You can do the same for another.

huangapple
  • 本文由 发表于 2023年8月5日 02:15:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76838305.html
匿名

发表评论

匿名网友

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

确定