title: Everything matches but I still get "Bad state: field does not exist within the DocumentSnapshotPlatform"
body: <p>So i'm pretty lost trying to get my app to fetch not only the desired text from firestore but also the image i placed there. I know the error &quot;Bad state: field does not exist within the DocumentSnapshotPlatform&quot; implies that either I'm missing field or there's something wrong with at least one of those fields. There's only four things I'm trying to fetch from firestore <strong>&quot;imgUrl, title, desc, organizer&quot;</strong> i have checked for spelling and order and i can't figure it out. I have also checked firestore to see if the order and spelling was correct and i dont see what's the issue. Please help, Thank you so much in advanced.</p>
  <p>////////////////////////////// News Class Starts\\\\\\\\\\\\\\</p>
  <pre><code>import 'package:myfuji/screens/CrudMethods.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:flutter/material.dart';
  import 'CrudMethods.dart';
  import 'add_blog.dart';
  
  class News extends StatefulWidget {
    @override
    _NewsState createState() =&gt; _NewsState();
  }
  
  class _NewsState extends State&lt;News&gt; {
    CrudMethods crudMethods = CrudMethods();
  
    late QuerySnapshot blogSnapshot;
  
    @override
    void initState() {
      crudMethods.getData().then((result) {
        blogSnapshot = result;
        setState(() {});
      });
      super.initState();
    }
  
    Widget blogsList() {
      return ListView.builder(
        padding: const EdgeInsets.only(top: 24),
        itemCount: blogSnapshot.docs.length,
        itemBuilder: (context, index) {
          return BlogTile(
            organizer: blogSnapshot.docs[index].get('Organizer'),
            desc: blogSnapshot.docs[index].get('desc'),
            imgUrl: blogSnapshot.docs[index].get('imgUrl'),
            title: blogSnapshot.docs[index].get('title'),
          );
        },
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: const Text(&quot;Events&quot;),
        ),
        body: Container(
            child: blogSnapshot != null
                ? blogsList()
                : const Center(
                    child: CircularProgressIndicator(),
                  )),
        floatingActionButton: FloatingActionButton(
          child: const Icon(Icons.add),
          onPressed: () {
            Navigator.push(
                context, MaterialPageRoute(builder: (context) =&gt; AddBlog()));
          },
        ),
      );
    }
  }
  
  class BlogTile extends StatelessWidget {
    final String imgUrl, title, desc, organizer;
    const BlogTile(
        {required this.organizer,
        required this.desc,
        required this.imgUrl,
        required this.title});
  
    @override
    Widget build(BuildContext context) {
      return Container(
        margin: const EdgeInsets.only(bottom: 24, right: 16, left: 16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              child: ClipRRect(
                borderRadius: const BorderRadius.all(Radius.circular(8)),
                child: Image.network(
                  imgUrl,
                  width: MediaQuery.of(context).size.width,
                  fit: BoxFit.cover,
                  height: 200,
                ),
              ),
            ),
            const SizedBox(height: 16),
            Text(
              title,
              style: const TextStyle(fontSize: 17),
            ),
            const SizedBox(height: 2),
            Text(
              '$desc - By $organizer',
              style: const TextStyle(fontSize: 14),
            )
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>///////////////////////////////////////////// class AddBlog begins here \\\\\\\\\\\</p>
  <pre><code>import 'dart:io';
  import 'package:myfuji/screens/CrudMethods.dart';
  import 'package:firebase_storage/firebase_storage.dart';
  
  import 'package:flutter/material.dart';
  import 'package:image_picker/image_picker.dart';
  import 'package:random_string/random_string.dart';
  
  class AddBlog extends StatefulWidget {
    @override
    _AddBlogState createState() =&gt; _AddBlogState();
  }
  
  class _AddBlogState extends State&lt;AddBlog&gt; {
    //
    late File selectedImage;
    final picker = ImagePicker();
  
    bool isLoading = false;
  
    CrudMethods crudMethods = new CrudMethods();
  
    Future getImage() async {
      final pickedFile = await picker.getImage(source: ImageSource.gallery);
  
      setState(() {
        if (pickedFile != null) {
          selectedImage = File(pickedFile.path);
        } else {
          print('No image selected.');
        }
      });
    }
  
    Future&lt;void&gt; uploadBlog() async {
      if (selectedImage != null) {
        // upload the image
  
        setState(() {
          isLoading = true;
        });
        Reference firebaseStorageRef = FirebaseStorage.instance
            .ref()
            .child(&quot;events/&quot;)
            .child(&quot;${randomAlphaNumeric(9)}.jpg&quot;);
  
        final UploadTask task = firebaseStorageRef.putFile(selectedImage);
  
        var imageUrl;
        await task.whenComplete(() async {
          try {
            imageUrl = await firebaseStorageRef.getDownloadURL();
          } catch (onError) {
            print(&quot;Error&quot;);
          }
  
          print(imageUrl);
        });
  
        // print(downloadUrl);
  
        Map&lt;String, dynamic&gt; blogData = {
          &quot;imgUrl&quot;: imageUrl,
          &quot;Organizer&quot;: authorTextEditingController.text,
          &quot;title&quot;: titleTextEditingController.text,
          &quot;desc&quot;: descTextEditingController.text
        };
  
        crudMethods.addData(blogData).then((value) {
          setState(() {
            isLoading = false;
          });
          Navigator.pop(context);
        });
  
        // upload the blog info
      }
    }
  
    //
    TextEditingController titleTextEditingController =
        new TextEditingController();
    TextEditingController descTextEditingController = new TextEditingController();
    TextEditingController authorTextEditingController =
        new TextEditingController();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(&quot;Create Blog&quot;),
          actions: [
            GestureDetector(
              onTap: () {
                uploadBlog();
              },
              child: Padding(
                  padding: EdgeInsets.symmetric(horizontal: 16),
                  child: Icon(Icons.file_upload)),
            )
          ],
        ),
        body: isLoading
            ? Container(
                child: Center(
                child: CircularProgressIndicator(),
              ))
            : SingleChildScrollView(
                child: Container(
                    margin: EdgeInsets.symmetric(horizontal: 16),
                    child: Column(
                      children: [
                        GestureDetector(
                          onTap: () {
                            getImage();
                          },
                          child: selectedImage != null
                              ? Container(
                                  height: 150,
                                  margin: EdgeInsets.symmetric(vertical: 24),
                                  width: MediaQuery.of(context).size.width,
                                  child: ClipRRect(
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(8)),
                                    child: Image.file(
                                      selectedImage,
                                      fit: BoxFit.cover,
                                    ),
                                  ),
                                )
                              : Container(
                                  height: 150,
                                  decoration: BoxDecoration(
                                      color: Colors.grey,
                                      borderRadius:
                                          BorderRadius.all(Radius.circular(8))),
                                  margin: EdgeInsets.symmetric(vertical: 24),
                                  width: MediaQuery.of(context).size.width,
                                  child: Icon(
                                    Icons.camera_alt,
                                    color: Colors.white,
                                  ),
                                ),
                        ),
                        TextField(
                          controller: titleTextEditingController,
                          decoration: InputDecoration(hintText: &quot;enter title&quot;),
                        ),
                        TextField(
                          controller: descTextEditingController,
                          decoration: InputDecoration(hintText: &quot;enter desc&quot;),
                        ),
                        TextField(
                          controller: authorTextEditingController,
                          decoration:
                              InputDecoration(hintText: &quot;enter author name&quot;),
                        ),
                      ],
                    )),
              ),
      );
    }
  }
  </code></pre>
  <p>///////////////////////////////////////////// class CrudMethods begins here \\\\\\\\\\\</p>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  
  class CrudMethods {
    Future&lt;void&gt; addData(blogData) async {
      print(blogData);
      FirebaseFirestore.instance
          .collection(&quot;events/&quot;)
          .add(blogData)
          .then((value) =&gt; print(value))
          .catchError((e) {
        print(e);
      });
    }
  
    getData() async {
      return await FirebaseFirestore.instance.collection(&quot;events/&quot;).get();
    }
  }
  </code></pre>
  <p>/////////////////////////////////////////////firestore\\\\\\\\\\\\\</p>
  <p><a href="https://i.stack.imgur.com/VWt0s.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VWt0s.jpg" alt="enter image description here" /></a></p>