HopeOptions class
Configuration for a HopeBuilder query.
Example:
HopeOptions(
staleTime: Duration(minutes: 2),
retryCount: 3,
enabled: true,
)
Constructors
- HopeOptions({Duration staleTime = Duration.zero, Duration? refetchInterval, int retryCount = 3, Duration retryDelay = const Duration(seconds: 2), bool enabled = true, bool refetchOnResume = true})
-
When true, never calls the fetcher. Serves from cache only.
Returns empty state if nothing is cached.
const
Properties
- enabled → bool
-
Set to false to skip fetching entirely. Useful for dependent queries.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- refetchInterval → Duration?
-
Automatically refetch on this interval. Null means no auto-refetch.
final
- refetchOnResume → bool
-
Refetch when app comes back to foreground. Defaults to true.
final
- retryCount → int
-
How many times to retry a failed fetch before setting error state.
Defaults to 3.
final
- retryDelay → Duration
-
Delay between retries. Defaults to 2 seconds.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- staleTime → Duration
-
How long before cached data is considered stale and refetched in background.
Defaults to Duration.zero — always refetch on mount.
final
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