Kotlin Realm: Class must declare a public constructor with no arguments if it contains custom constructors
To clear this error you have to assign default values to properties.
Change the Realm Object like this:
open class PurposeModel(
var _id: Long? = 0,
var purposeEn: String? = null,
var purposeAr: String? = null
) : RealmObject()
Now it will compile.
Reason:
When the default value not assigned it will become the parameters of the constructor, Realm need a public constructor with no arguments. When the default value assigned, it will become the properties of the class. So you will get empty constructor by default and clean code.
That's why I prefer to define them like this
open class PurposeModel : RealmObject() {
@field:PrimaryKey
var id: Long? = null
var purposeEn: String? = null
var purposeAr: String? = null
}