I want to convert this list string to list stateful widget
List<String> listString = [
"HomePage()",
"ProfilePage()"
]
to
List<StatefulWidget> listStatefulWidget = [];
expected result :
List<StatefulWidget> listStatefulWidget = [
HomePage(),
ProfilePage()
];
update :
I need this for my navbar that require a list of StatefulWidget. tabs
is list of StatefulWidget thats should be get the value from API. my API return listString, so I need to convert it to statefulWidget.
here my code:
var tabs<StatefulWidget> = [
HomePageView()
AccountView(),
];
return Scaffold(
key: scaffoldKey,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
bottomNavigationBar: CurvedNavigationBar(
key: _bottomNavigationKey,
index: 0,
height: 65.0,
items: [
//navbar
],
color: Colors.white,
buttonBackgroundColor: kSecondaryColor,
backgroundColor: Colors.transparent,
animationCurve: Curves.easeInOutQuint,
animationDuration: Duration(milliseconds: 300),
onTap: (index) {
setState(() {
_page = index;
});
},
letIndexChange: (index) => true,
),
body: tabs[_page]);
}