I can not create 2 constructors which one is empty while other one taking parameters in Flutter/Dart?

75 Views Asked by At

The error I get is: All final variables must be initialized, but 'clicked' isn't.
Try adding an initializer for the field.

enter image description hereenter image description here

I was trying to pass the clicked data to another page by using BottomNavigationBar. I need to use constructors. I need 2 of them which is one of them has to be empty in my case. How can I do this?

1

There are 1 best solutions below

0
On

You are not using the empty constructor in myHome.dart but the one that needs an argument. So in myHome.dart line 16 should be:

List<Widget> _screens = [MainHomeView(), KullaniciSayfasi.empty()];