LoadableContainer<T> class
A container for loadable state, providing a clean way to represent loading states without null checks.
This class is designed to wrap values that need to be loaded asynchronously, providing a clear indication of whether the value has been loaded.
@ai Use this class to manage loading states in your application, ensuring that the UI can react appropriately to changes in loading status.
Example usage:
final loadableData = LoadableContainer(value: myData, isLoaded: true);
- Annotations
-
- @freezed
Constructors
- LoadableContainer({required T value, @Default(false) bool isLoaded})
-
constfactory
- LoadableContainer.loaded(T value)
-
Creates a LoadableContainer with a loaded state.
factory
Properties
-
copyWith
→ $LoadableContainerCopyWith<
T, LoadableContainer< T> > -
Create a copy of LoadableContainer
with the given fields replaced by the non-null parameter values.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLoaded → bool
-
no setterinherited
- isLoading → bool
-
Whether the container is currently in a loading state.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
no setterinherited
Methods
-
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