title: Kotlin Firebase Deserialization
body: <p>I'm trying to deserialize data from Firebase to POJO with Kotlin, this is my POJO class:</p>
  
  <pre><code>class Message {
  var number: String ?= null
  var message: String? = null
  var timestamp: Long = 0L
  var isHandled: Boolean ?= false
  var type:String ?=null
  }
  </code></pre>
  
  <p>and this is my code to retrieve data from Firebase</p>
  
  <pre><code>val query = Fire.REF.child("sms").orderByChild("type").equalTo("outbox-unsent")
      query.addChildEventListener(object : ChildEventListener {
          override fun onChildAdded(dataSnapshot: DataSnapshot, key: String) {
              val outbox = dataSnapshot.getValue(Message::class.java)
              Log.d("BS", "Background Service $outbox")
             }
  //......
  });
  </code></pre>
  
  <p>this is my data structure on Firebase look like</p>
  
  <pre><code>"sms":{
  "-KI3ar91oBXGNpXXrOCS" : {
  "handled" : false,
  "message" : "Pak kenapa koneksi...",
  "number" : "+6285830166314",
  "timestamp" : 1463587399000,
  "type" : "inbox"
  },
  //.......//
  }
  </code></pre>
  
  <p>When I execute the code it raises an error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter key
  </code></pre>
  
  <p>Where is my mistake on above code?</p>