Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use @Parcelize in Kotlin 1.1.60?

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 ?

like image 325
ckybonist Avatar asked Dec 17 '25 06:12

ckybonist


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).

like image 178
Ekeko Avatar answered Dec 19 '25 22:12

Ekeko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!