How to use @Parcelize in Kotlin 1.1.60?

Viewed 466

Kotlin 1.1.60 is recently out with the Parcelable support.

With this new feature, I created my data as:

@Parcelize 
data class Question {
   val id: String,
   val title: String,
   val detail: String
} : Parcelable

But this raise an error of This class implements Parcelable but does not provide a CREATOR field.

It seems like I still have to write tedious code to implement Parcel data, if so, what's the benefit of using @Parcelize ?

1 Answers

I would say this feature is still experimental. What you describe is a known bug: https://youtrack.jetbrains.com/issue/KT-19300

But it should not be preventing the code from being compiled as expected (try disregarding the warning and see if your code works as expected).

Related