title: Firebase Firestore toObject() with Kotlin
body: <p>I try to use Firebase Firestore in a Kotlin project. Everything is going fine except when I want to instantiate an object with DocumentSnapshot.toObject(Class valueType).</p>
  
  <p>Here is the code :</p>
  
  <pre><code>FirebaseFirestore
      .getInstance()
      .collection("myObjects")
      .addSnapshotListener(this,
      { querySnapshot: QuerySnapshot?, e: FirebaseFirestoreException? -&gt;
  
          for (document in querySnapshot.documents) {
  
              val myObject = document.toObject(MyObject::class.java)
  
              Log.e(TAG,document.data.get("foo")) // Print : "foo"
              Log.e(TAG, myObject.foo) // Print : ""
          }
      }
  })
  </code></pre>
  
  <p>As you can see, when I use <code>documentChange.document.toObject(MyObject::class.java)</code>, my object is instantiated but the inner fields are not set.
  I know that Firestore needs the model to have an empty constructor. So here is the model :</p>
  
  <pre><code>class MyObject {
  
      var foo: String = ""
  
      constructor(){}
  
  }
  </code></pre>
  
  <p>Can somebody tell me what I'm doing wrong?</p>
  
  <p>Thank you</p>