title: Cloud Firestore is not adding data in flutter
body: <p>In my project, I simply created a form with an image picker. The idea is to create an event data with name, email, image and more. I already uploaded the image to Firebase storage but I cannot add the rest of my data to Firestore.</p>
  <p>The data is correctly fetched and passed to next page, though.</p>
  <p>Here is my code:</p>
  <pre><code>  onPressed: () async {
      if(_formKey.currentState.validate()&amp;&amp; _image!=null){
        var name = nameController.text;
        var price = priceController.text;
        var description = descriptionController.text;
        var location = locationController.text;
        var ticket = ticketController.text;
        var date;
        if(dateChecked==true){
          setState(() {
            date = _startDate;
          });
        }
        else if(dateChecked==false){
          setState(() {
            date=_days[_selectedDay];
          });
        }
        var time = _time;
        var type = _options[_selectedIndex];
        var img;
          await Firebase.initializeApp();
         Reference reference = await _storage.ref().child('${name}/${date}');
         final UploadTask uploadTask = reference.putFile(_image);
         uploadTask.whenComplete(() async{
           img = await uploadTask.snapshot.ref.getDownloadURL();
           print(img);
           Navigator.of(context).push(MaterialPageRoute(
               builder: (context) =&gt; PostSuccess(
                   name,price,date,time,location,type,_image,description,ticket
               )));
         });
       await FirebaseFirestore.instance.collection('events').doc(name).set(
            {
              'name': name,
              'price': price,
              'date': date,
              'time': time,
              'location': location,
              'type': type,
              'description': description,
              'tickets': ticket
            });
      }
      else{
        print('validate first');
      }
    },
  </code></pre>
  <p>Where am I making the mistakes?</p>