执行应用程序时,Flutter取决于错误

wlzqhblo  于 2023-01-14  发布在  Flutter
关注(0)|答案(2)|浏览(176)

我正在将我的应用迁移到Android 12,但在依赖项和版本方面遇到了一些问题。该应用到目前为止运行良好。当我尝试执行它时,我收到了此错误。
../../../AppData/Local/Android/flutter/. pub-cache/hosted/www.example.com错误:无法从返回类型为'Future'的函数返回类型为'bool'的值。pub.dartlang.org/firebase_messaging-13.1.0/lib/src/messaging.dart:128:22: Error: A value of type 'bool' can't be returned from a function with return type 'Future'.

  • "将来"来自"dart:async"。return_delegate. isSupported();^../../../AppData/Local/Android/flutter/. pub-cache/hosted/www.example.com错误:没有为类"防火墙消息平台"定义方法"setDeliveryMetricsExportToBigQuery"。pub.dartlang.org/firebase_messaging-13.1.0/lib/src/messaging.dart:238:22: Error: The method 'setDeliveryMetricsExportToBigQuery' isn't defined for the class 'FirebaseMessagingPlatform'.
  • "Firebase消息平台"来自"package:firebase消息平台接口/src/平台接口/平台接口消息. dart"('../../../AppData/Local/Android/flutter/. pub-cache/hosted/pub.dartlang.org/firebase消息平台接口-3.2.1/lib/src/平台接口/平台接口消息. dart')。请尝试将名称更正为现有方法的名称,或定义名为"setDeliveryMetricsExportToBigQuery"的方法。return_delegate. setDeliveryMetricsExportToBigQuery(启用);^^^^^^^^^^^^^^^^^^^^^^^^^^^../../../AppData/Local/Android/flutter/. pub-cache/hosted/www.example.com错误:未找到会员:pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25:^^^^^^^^^^^^^ 'FirebaseAppPlatform.verifyExtends'. FirebaseAppPlatform.verifyExtends(_delegate); ^^^^^^^^^^^^^

失败:生成失败,出现异常。
下面是我的pubspec.yaml文件

name: atgapp
description: A new Flutter project.

publish_to: 'none' 

version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  firebase_core: ^1.12.0
  cloud_firestore: ^3.1.7
  firebase_storage: ^10.2.6
  file_picker: ^5.2.5
  path_provider: ^2.0.1
  image_picker:
  firebase_messaging: ^13.1.0
  flutter_local_notifications: ^13.0.0
  cloud_functions: ^3.2.8
  firebase_auth: ^3.11.2
  animated_splash_screen: ^1.2.0
  diacritic: ^0.1.3
  restart_app: ^1.1.0
  #firebase_messaging: ^10.0.0
dependency_overrides:
  firebase_messaging_platform_interface: 3.2.1

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.1

flutter:
  uses-material-design: true
zazmityj

zazmityj1#

删除pubspec.lock并再次运行。

jm81lzqq

jm81lzqq2#

解决了!我已经解决了在pubdev中搜索所有与firebase相关的依赖项(核心,消息等),并在我的清单中替换最后发布的版本。现在,应用程序似乎按预期工作。

相关问题