I want to update user profile where user is:
class UserModel {
final String uid;
String name;
List<GroupModel> group;
LocationModel location;
String profileImageUrl;
}
and this is the button:
TextButton(
onPressed: () async {
reBuild = true;
UserModel updatedUserInfo = UserModel(
name: widget.nameController.text,
profileImageUrl: widget.userInfo.profileImageUrl,
group: widget.userInfo.group,
location: widget.userInfo.location,
uid: widget.userInfo.uid,
);
await updateUserCubit
.updateUserInfo(updatedUserInfo)
.whenComplete(() {
Future.delayed(Duration.zero, () {
Navigator.of(context).maybePop(widget.userInfo);
reBuild = false;
});
});
},
child: checkText(false),
)
but I have the error Invalid argument: Instance of 'GroupModel'and I dont know why because group wants a List and widget.userInfo.group is a List Can you hel me?