Pass data b/w pageviews in Flutter: use PageStorage + PageStorageKey

I am trying to pass data from one page to another in a PageView widget with five pages. I have taken a Next button in each page and I have implemented the onTap() event for the button to slide to the next page. However, I need help figuring out how to carry data and pass it to the next page when the user presses the button.

Has anyone else faced this problem in Flutter? If so, please guide me on how to achieve this.

Widget buildPageView() {
    return PageView(
      controller: pageController,

      onPageChanged: (index) {

      children: <Widget>[
        AddPropertyDescription(pageController: pageController,),
        AddPropertyMedia(pageController: pageController),
        AddPropertyLocation(pageController: pageController),
        AddPropertyDetails(pageController: pageController),
        AddPropertyAmenities(pageController: pageController)
 onTap: () async{
                    duration: Duration(milliseconds: 300),
                    curve: Curves.linear,

To pass data from one page to another in a PageView widget, you can use the Navigator class and its push method to navigate to the next page and pass the data in the arguments parameter. Here’s an example:

In the current page:

onTap: () async{
  final data = {'key': 'value'}; // replace with your data
  await Navigator.push(
      builder: (context) => NextPage(data: data),

In the next page:

class NextPage extends StatelessWidget {
  final Map<String, dynamic> data;

  const NextPage({Key key,}) : super(key: key);

  Widget build(BuildContext context) {
    return Container(
      child: Text(data['key']), // replace with your widget tree