Reputation: 3651
I am facing weird issue I have kotlin class like below
class RequestCenterDetails : Serializable{
var instituteId: String? = null
var centerId: String? = null
var centerKey: String? = null
var instituteKey: String? = null
var studentId: String? = null
var studentUID: String? = null
var studentFullName: String? = null
var studentEmailId: String? = null
var status: String? = null
var requestTime: Long? = null
var grantTime: Long? = null
var grantUserUID: String? = null
var grantUserEmailID: String? = null
var rejectComment: String? = null
var grantUserName: String? = null
var active: Boolean? = null
var instituteName: String? = null
var centerAddress: String? = null
var centerLocation: GeoPoint? = null
// this function return value is getting stored in firebase
fun isActiveRequest() : Boolean {
return active ?: false
}
}
and this is how i am saving into firebase
DatabaseReference requestRef = studentAccessRequestRef.child("/" + appfirebaseUserId + "/" + requestDetails.getCenterKey());
requestRef.setValue(requestDetails);
and this is how its store its return type
I want to know why it is storing function return value. #AskFirebase
Upvotes: 2
Views: 181
Reputation: 5251
Just use @Exclude
annotation to avoid that, otherwise Firebase SDK triggers that value to POJO object due to variable serialization.
Try something like following:
@Exclude
fun isActiveRequest(): Boolean = active ?: false
Upvotes: 4