title: Error: The method 'data' isn't defined for the class 'Object?'
body: <pre class="lang-none prettyprint-override"><code>Error: The method 'data' isn't defined for the class 'Object?'.
   - 'Object' is from 'dart:core'.
  Try correcting the name to the name of an existing method, or defining a method named 'data'.
                              Map _productMap = productSnap.data.data();      
  </code></pre>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:flutter/material.dart';
  import 'package:your_store/screens/product_page.dart';
  import 'package:your_store/services/firebase_services.dart';
  import 'package:your_store/widgets/custom_action_bar.dart';
  
  class SavedTab extends StatelessWidget {
    final FirebaseServices _firebaseServices = FirebaseServices();
  
    @override
    Widget build(BuildContext context) {
      return Container(
        child: Stack(
          children: [
            FutureBuilder&lt;QuerySnapshot&gt;(
              future: _firebaseServices.usersRef
                  .doc(_firebaseServices.getUserId())
                  .collection(&quot;Saved&quot;)
                  .get(),
              builder: (context, snapshot) {
                if (snapshot.hasError) {
                  return Scaffold(
                    body: Center(
                      child: Text(&quot;Error: ${snapshot.error}&quot;),
                    ),
                  );
                }
  
                // Collection Data ready to display
                if (snapshot.connectionState == ConnectionState.done) {
                  // Display the data inside a list view
                  return ListView(
                    padding: EdgeInsets.only(
                      top: 108.0,
                      bottom: 12.0,
                    ),
                    children: snapshot.data!.docs.map((document) {
                      return GestureDetector(
                        onTap: () {
                          Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) =&gt; ProductPage(
                                  productId: document.id,
                                ),
                              ));
                        },
                        child: FutureBuilder(
                          future:
                              _firebaseServices.productRef.doc(document.id).get(),
                          builder: (context, productSnap) {
                            if (productSnap.hasError) {
                              return Container(
                                child: Center(
                                  child: Text(&quot;${productSnap.error}&quot;),
                                ),
                              );
                            }
  
                            if (productSnap.connectionState ==
                                ConnectionState.done) {
                              Map _productMap = productSnap.data.data();
  
                              return Padding(
                                padding: const EdgeInsets.symmetric(
                                  vertical: 16.0,
                                  horizontal: 24.0,
                                ),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  children: [
                                    Container(
                                      width: 90,
                                      height: 90,
                                      child: ClipRRect(
                                        borderRadius: BorderRadius.circular(8.0),
                                        child: Image.network(
                                          &quot;${_productMap['images'][0]}&quot;,
                                          fit: BoxFit.cover,
                                        ),
                                      ),
                                    ),
                                    Container(
                                      padding: EdgeInsets.only(
                                        left: 16.0,
                                      ),
                                      child: Column(
                                        mainAxisAlignment:
                                            MainAxisAlignment.start,
                                        crossAxisAlignment:
                                            CrossAxisAlignment.start,
                                        children: [
                                          Text(
                                            &quot;${_productMap['name']}&quot;,
                                            style: TextStyle(
                                                fontSize: 18.0,
                                                color: Colors.black,
                                                fontWeight: FontWeight.w600),
                                          ),
                                          Padding(
                                            padding: const EdgeInsets.symmetric(
                                              vertical: 4.0,
                                            ),
                                            child: Text(
                                              &quot;\$${_productMap['price']}&quot;,
                                              style: TextStyle(
                                                  fontSize: 16.0,
                                                  color: Theme.of(context)
                                                      .accentColor,
                                                  fontWeight: FontWeight.w600),
                                            ),
                                          ),
                                          Text(
                                            &quot;Size - ${document['size']}&quot;,
                                            style: TextStyle(
                                                fontSize: 16.0,
                                                color: Colors.black,
                                                fontWeight: FontWeight.w600),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ],
                                ),
                              );
                            }
  
                            return Container(
                              child: Center(
                                child: CircularProgressIndicator(),
                              ),
                            );
                          },
                        ),
                      );
                    }).toList(),
                  );
                }
  
                // Loading State
                return Scaffold(
                  body: Center(
                    child: CircularProgressIndicator(),
                  ),
                );
              },
            ),
            CustomActionBar(
              title: &quot;Saved&quot;,
              hasBackArrow: false,
            ),
          ],
        ),
      );
    }
  }
  </code></pre>