JState class abstract
An immutable base class representing the state in an application.
The JState class is designed to be used as a base class for defining state
in an application. It extends Equatable, allowing instances of JState to
be compared for equality based on their properties. This makes it useful in
state management scenarios, where changes in state need to be detected
efficiently.
This class is intended to be extended by concrete state classes, which
should implement their own copyWith method to create new instances
with modified properties.
immutable is an analyzer contract, not a runtime freeze. Use final fields and defensive copies or unmodifiable collections, including nested values. Include every value relevant to state equality in props. Controllers skip updates when the previous and next states compare equal.
Key Features:
- Immutable: Once an instance of
JStateis created, it cannot be modified. - Equatable Integration: Supports equality comparison based on properties.
Subclasses must override:
copyWith: To create a new instance of the state with modified properties.props: To define the list of properties used for equality comparison.
- Inheritance
- Implementers
- Annotations
Constructors
- JState()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
The list of properties used to determine equality.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
copyWith(
) → JState - Creates a copy of the current state with optional modifications.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited