I want to pass the instance of class Paricipant to the tab bars. I tried to make the List late, but it didn't show the information at the begining(I have to go to another page and go back to see).
class MainTabBar extends StatelessWidget {
MainTabBar({Key? key, required this.userInfo}) : super(key: key);
final ParticipantInfo userInfo;
final List<ItemView> items = <ItemView>[
ItemView(title: "User", icon: Icons.account_box, view: UserProfileTab(userInfo: userInfo)),
ItemView(title: "Current State", icon: Icons.content_paste, view: CurrentStatesTab(roomNumber: userInfo.location,)),
const ItemView(title: "All data", icon: Icons.table_rows_rounded, view: AllInfoTab()),
];
@override
Widget build(BuildContext context) {......
lib/main.dart:44:85: Error: Can't access 'this' in a field initializer to read 'userInfo'.
ItemView(title: "User", icon: Icons.account_box, view: UserProfileTab(userInfo: userInfo)),
^^^^^^^^
lib/main.dart:45:100: Error: Can't access 'this' in a field initializer to read 'userInfo'.
ItemView(title: "Current State", icon: Icons.content_paste, view: CurrentStatesTab(roomNumber: userInfo.location,)),