I am new to flutter this error is giving me a serious nightmare. I have a card list of items called Anchors. These items are coming from the shared preference file which belongs
The problem seems to be here
detailsPage(value : anchors[i]['Oid'])
You're passing Oid
as parameter that is an Int
. But look that the constructor for detailsPage
List value;
detailsPage({Key key, @required this.value}) : super(key: key);
The parameter value
is a List
. It's hard for me to know what you're trying to do... but you will need to fix this type mismatch.
EDIT
It seems that value
parameter should be of type Map
class detailsPage extends StatefulWidget {
Map value;
detailsPage({Key key, @required this.value}) : super(key: key);
@override
_detailsPageState createState() => _detailsPageState(value);
}
class _detailsPageState extends State {
Map value;
_detailsPageState(this.value);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Anchors Details Page"),
iconTheme: IconThemeData(color: Colors.white),
backgroundColor: Colors.green,
),
body: Container(
child: ListView(
children: [
Text(value['Name']),
Text(value['Oid'].toString()),
ListView.builder(
shrinkWrap: true,
itemCount: value['DistributionCentres'].length,
//context:context, //it saying the name parameter context is not defined
physics: NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int i) {
return Text(value['DistributionCentres'][i]['Name']);
})
],
),
),
);
}
}
And then you should do
detailsPage(value : anchors[i])));