This is the code of ListView page which displays the cards with data from json api
Widget getData() {
return ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: content.length,
itemBuilder: (context, index) {
// return Text('index, $index');
return postCard(content[index]);
});}
Widget postCard(content) {
var imageURL = content['yoast_head_json']['og_image'][0]['url'];
var title = content['title']['rendered'];
var date = content['date'];
print(title);
return Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Card(
color: Colors.white,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const PostDetails()));
},
On the Details Page I want to use the variables that get data from the api to make the details page. I want it to have the same variable of the particular index when clicked. Example, the image and post title on the card should be the same as the the title and image not the details page