Fixed
Status Update
Comments
go...@jakewharton.com <go...@jakewharton.com> #2
Partly, this is my fault -- val is not that useful in the @Model context, since @Model relies on mutability. I am used to thinking in terms of immutable viewstates and screwed this up.
However, it probably should not crash this way. Either it should work (with a never-changing value) or it should fail with a "are you *really* sure you want this here?" sort of error.
However, it probably should not crash this way. Either it should work (with a never-changing value) or it should fail with a "are you *really* sure you want this here?" sort of error.
so...@google.com <so...@google.com> #3
I'd like to add that declaring `canProceed` as a `var` won't crash the app.
The extension function is avoidable by just having the `get()`-getter function inside the class itself. That also avoids the crash.
The extension function is avoidable by just having the `get()`-getter function inside the class itself. That also avoids the crash.
ad...@google.com <ad...@google.com> #4
Try,
@Model
data class AgreementViewState(var terms: Boolean, var privacy: Boolean) {
val canProceed get() = terms && privacy
}
(note the addtion of get()) which seems to be what you intended. `val canProceed = terms && privacy` is not a derived property, rather, it is an initialized property.
@Model
data class AgreementViewState(var terms: Boolean, var privacy: Boolean) {
val canProceed get() = terms && privacy
}
(note the addtion of get()) which seems to be what you intended. `val canProceed = terms && privacy` is not a derived property, rather, it is an initialized property.
Description
The only way to create a
Composition
is through thecompositionFor
factory which goes through a staticCompositions
object which maintains a static weak map.Adam P has tentatively said that removing this was in the plans. This is mostly just a tracking bug. Bonus: This means the expect/actual for
WeakMap
can be removed.