MiniProgramCacheRule class abstract
Cache rules declared by a mini-program manifest for one payload class.
maxStaleSeconds bounds how long a stale cached copy may be reused after a
retryable backend failure. When omitted, the SDK falls back to the default
contract value of 3600 seconds.
- Available extensions
- Annotations
-
- @freezed
Constructors
- MiniProgramCacheRule({@Default.new(MiniProgramCacheMode.staleWhileError) MiniProgramCacheMode mode, @JsonKey.new(includeIfNull: false) int? maxStaleSeconds})
-
constfactory
-
MiniProgramCacheRule.fromJson(Map<
String, dynamic> json) -
factory
Properties
- allowsStaleCache → bool
-
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRuleX extension
Whether stale cached content may be reused for this payload.no setter -
copyWith
→ $MiniProgramCacheRuleCopyWith<
MiniProgramCacheRule> -
Create a copy of MiniProgramCacheRule
with the given fields replaced by the non-null parameter values.
no setterinherited
- effectiveMaxStaleAge → Duration
-
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRuleX extension
Contract-defined maximum stale age for retryable offline fallback.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- maxStaleSeconds → int?
-
no setterinherited
- mode → MiniProgramCacheMode
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_MiniProgramCacheRule value)) → TResult -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(_MiniProgramCacheRule value)?) → TResult? -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> (TResult $default(_MiniProgramCacheRule value)?, {required TResult orElse()}) → TResult -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> (TResult $default(MiniProgramCacheMode mode, int? maxStaleSeconds)?, {required TResult orElse()}) → TResult -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this MiniProgramCacheRule to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(MiniProgramCacheMode mode, int? maxStaleSeconds)) → TResult -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> (TResult? $default(MiniProgramCacheMode mode, int? maxStaleSeconds)?) → TResult? -
Available on MiniProgramCacheRule, provided by the MiniProgramCacheRulePatterns extension
A variant ofwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited