getCustom method
State?
getCustom()
Retrieves the custom state of the session as a typed State.
When a stateSchema was supplied, the stored JSON is parsed into a real
State instance; otherwise the raw JSON is returned (a bare view cast to
State). Returns null when no custom state has been set.
Unlike the untyped JS implementation this returns a parsed value, so
(when a schema is present) mutating it in place does not write back to the
session - always persist changes through updateCustom. When no schema is
present and the state is a raw Map/List, the returned value still
aliases the live internal JSON, so treat it as read-only for the same
reason: an in-place mutation bypasses the version bump and the
customChanged event, so no customPatch is emitted upstack.
Implementation
State? getCustom() => castOrParseState<State>(_json['custom'], _stateSchema);