首先,这是我遇到的错误:
/C:/Users/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_auth_web-5.2.2/lib/firebase_auth_web.dart:92:45:错误:无法将参数类型“Future Function()”分配给参数类型“Future Function(App)?”。
- “未来”来自“dart:async”。
- “应用程序”来自“软件包:Firebase_core_web/src/互操作/应用程序.dart”('/C:/用户/Grace%20计算机/应用程序数据/本地/发布/缓存/托管/发布.开发/Firebase_core_web-2.2.2/库/src/互操作/应用程序. dart').应用程序.dart:1 Firebase_core_web.注册表服务('auth',()异步{ ^
未能编译应用程序。
我正在尝试运行一个flutter登录应用程序。我已经粘贴了所需的creditentials,如在web〉index.html文件。主.dart文件看起来像这样:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: const FirebaseOptions(
apiKey: "AIzaSyDZvxw2LXy05hLkcH_fpPWWa5RzwVlbQro",
projectId: "messageapp-acf7a",
messagingSenderId: "72207922701",
appId: "1:72207922701:web:d84fe3144a7f2de5dd4744"
),
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: SignupPage(),
);
}
}
pubspec.yaml文件的相关部分如下:
name: frontend_msngr
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.19.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
chat_bubbles:
firebase_core:
cupertino_icons: ^1.0.2
firebase_auth:
firebase_auth_web:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true```
Since,the file that got the error is lib/firebase_auth_web.dart , I don't know how I passed incorrect parameters (as suggested by the error).
I tried changing the versions a bitbut it didn't work for me.
2条答案
按热度按时间cunj1qz11#
跑
fnvucqvd2#
这个我过去用过,效果很好
pubsec文件的代码段