You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello after upgrading from 0.5.1 to 0.7.1 I get many errors that serializable is null, when trying to access it after some decoding , but it shouldnt be null, Im not sure what am I doing wrong.
Here is example of the code:
@ExperimentalSerializationApi
inline fun <reified T> Bundle.putParcelableTest(
key: String, value: T, parcelable: com.chrynan.parcelable.core.Parcelable = com.chrynan.parcelable.core.Parcelable.Default
) {
val encoded = parcelable.encodeToBundle(value = value)
putBundle(key, encoded)
// This works
val bundle = getBundle(key)
val decoded: T = parcelable.decodeFromBundle(requireNotNull(bundle))
// Returns null
val decoded2: T? = getParcelable(key, parcelable = com.chrynan.parcelable.core.Parcelable.Default)
// This works
val decoded3: T? = getParcelableTest(key, parcelable = com.chrynan.parcelable.core.Parcelable.Default)
}
@ExperimentalSerializationApi
inline fun <reified T : Any> Bundle.getParcelableTest(
key: String,
flags: Int = 0,
parcelable: com.chrynan.parcelable.core.Parcelable = com.chrynan.parcelable.core.Parcelable.Default
): T? {
val bundle = getBundle(key)
return parcelable.decodeFromBundle(requireNotNull(bundle))
}
The getParcelable bundle extension doesnt work here and returns null, however I realized that if I create my own extension that is reified T : Any instead of just reified T then it starts to work again. But this is not the only function which I have problem with, so Im not sure what am I doing wrong.
The text was updated successfully, but these errors were encountered:
Hello after upgrading from 0.5.1 to 0.7.1 I get many errors that serializable is null, when trying to access it after some decoding , but it shouldnt be null, Im not sure what am I doing wrong.
Here is example of the code:
The getParcelable bundle extension doesnt work here and returns null, however I realized that if I create my own extension that is reified T : Any instead of just reified T then it starts to work again. But this is not the only function which I have problem with, so Im not sure what am I doing wrong.
The text was updated successfully, but these errors were encountered: