我正在开发 Flutter 中的一个应用程序,我是新手,但我正在取得进展。但是,我遇到以下错误:
错误:无法将参数类型“Stream”分配给参数类型“Stream”。“流”来自“飞镖:异步”。“用户”来自“package:firebase_auth/firebase_auth.dart”值:AuthServices().user,
下面是我的main.dart代码
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StreamProvider<UserModel>.value(
value: AuthServices().user,
child: MaterialApp(
home: WelcomeScreen(),
routes: {
WelcomeScreen.id: (context) => WelcomeScreen(),
LoginScreen.id: (context) => LoginScreen(),
RegistrationScreen.id: (context) => RegistrationScreen(),
ModuleScreen.id: (context) => ModuleScreen(),
LectureListScreen.id: (context) => LectureListScreen(),
SettingsScreen.id: (context) => SettingsScreen(),
ResetPasswordScreen.id: (context) => ResetPasswordScreen(),
ChangePasswordScreen.id: (context) => ChangePasswordScreen(),
ChangeEmailScreen.id: (context) => ChangeEmailScreen(),
PracticalListScreen.id: (context) => PracticalListScreen(),
TestingListScreen.id: (context) => TestingListScreen(),
TestScreen.id: (context) => TestScreen(),
},
));
}
}
这是我的UserModel.dart代码
class UserModel {
final String uid;
final bool isAnonymous;
UserModel({this.uid, this.isAnonymous});
}
class UserData {
final String uid;
final String email;
final String firstName;
final String patronymic;
final String lastName;
final String studentID;
UserData(
{this.uid,
this.email,
this.firstName,
this.patronymic,
this.lastName,
this.studentID});
}
我已经尝试了所有可能的方法,还查看了网上但找不到问题所在。但是,我认为这与我在调用 Authservices 或解析它以便它可以接受参数时无法获得正确的“上下文”有关。
在这种情况下,通过指出我做错了什么以及我需要做些什么来解决这个问题,我们将不胜感激。
谢谢你的期待