Flutter Web fails with firebase "Too many positional arguments: 1 allowed, but 2 found"

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

Flutter Web fails with firebase "Too many positional arguments: 1 allowed, but 2 found"

问题

由于以下错误,自今天起我无法再运行我的Flutter Web项目:

> : 错误:太多的位置参数:允许1个,但找到了2个。
firebase_auth_web.dart:94
尝试删除多余的位置参数。
FirebaseCoreWeb.registerService('auth',(firebaseApp)async {
^
:上下文:找到此候选项,但参数不匹配。
firebase_core_web.dart:43
static void registerService(
^^^^^^^^^^^^^^^

我已经将CoreAuth更新到了最新版本:

> firebase_core: ^2.14.0
>
> firebase_auth: ^4.2.10

我正在运行Flutter 3.10.0

还有其他人遇到这个问题吗?我没有更改任何内容,至少不是故意的。

英文:

Since today I can not run my Flutter Web project anymore because it fails with:

> : Error: Too many positional arguments: 1 allowed, but 2 found.
firebase_auth_web.dart:94
Try removing the extra positional arguments.
FirebaseCoreWeb.registerService('auth', (firebaseApp) async {
^
: Context: Found this candidate, but the arguments don't match.
firebase_core_web.dart:43
static void registerService(
^^^^^^^^^^^^^^^

I've already updated the Core and Auth to the latest versions:

> firebase_core: ^2.14.0
>
> firebase_auth: ^4.2.10

And I am running Flutter 3.10.0.

Anyone else experiencing this issue? I didn't change anything, at least not on purpose.

答案1

得分: 7

同样的问题从6月10日开始,不过对我来说不是很关键,所以没有着急解决。刚刚看到你的帖子,再次尝试了一下。
通过以下步骤解决了问题:

flutter clean
flutter pub get
flutter pub upgrade firebase_core_web
flutter pub upgrade firebase_auth_web
flutter pub upgrade

也许这些包已经更新了,版本冲突可能不再存在。希望这有所帮助。

英文:

Had the same problem since June 10th, however it was not critical for me to solve. Just saw your post and tried it again.
Solved it by running:

flutter clean
flutter pub get
flutter pub upgrade firebase_core_web
flutter pub upgrade firebase_auth_web
flutter pub upgrade

Maybe the packages have been updated and the version interference is not there anymore. Hope this helps.

答案2

得分: 1

尝试运行 flutter clean,然后再次运行 flutter pub get,似乎你某种方式获取到了旧版本的 firebase_auth

因为在最新版本中(就是你列出的那个版本),registerService 的调用看起来不是这样的,它看起来像这样(链接),即一个定位参数和一个命名参数。

你还可以看到这就是 firebase_core 中的调用应该看起来的方式。

还要确保你没有任何依赖项覆盖。

英文:

Try to do a flutter clean and then a flutter pub get again, it seems like somehow you're getting an old version of firebase_auth.

Because in the newest version (which is the one that you've listed), the call to registerService doesn't look like that, it looks like this, i.e. one positional parameter and one named.

You can also see that is how the call should be looking like in firebase_core.

Also make sure that you don't have any dependency overrides.

huangapple
  • 本文由 发表于 2023年6月18日 19:30:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76500308.html
匿名

发表评论

匿名网友

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

确定