class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
final List pages = const [
MessagesPage(),
NotificationsPage(),
CallsPage(),
ContactsPage(),
];
@override
Widget build(BuildContext context) {
return const Scaffold(
body: pages[0],
bottomNavigationBar: _BottomNavigationBar(),
);
}
}
There’s an Invalid constant value error in body: pages[0]
if I call the Widget directly like body: MessagesPage()
then there’s no error.
I tried making everything const but nothing’s helping.
Is there any update in the new version of Flutter or have I done some mistake?
2
Answers
remove
const
remove
const
keyword: