FetchConfig class
Platform-neutral configuration for FetchBloc.
These values work identically across all platforms (mobile, desktop, web).
- Annotations
Constructors
-
FetchConfig({String? baseUrl, Duration connectTimeout = const Duration(seconds: 30), Duration receiveTimeout = const Duration(seconds: 30), Duration sendTimeout = const Duration(seconds: 30), CachePolicy defaultCachePolicy = CachePolicy.networkFirst, Duration? defaultTtl, int maxCacheSize = 50 * 1024 * 1024, int maxConcurrentRequests = 10, Map<
String, String> defaultHeaders = const {}, bool followRedirects = true, int maxRedirects = 5, int defaultMaxRetries = 3, bool validateStatus = true}) -
const
Properties
- baseUrl → String?
-
Base URL for all requests.
Example: 'https://api.example.com'
final
- connectTimeout → Duration
-
Default timeout for establishing connection.
final
- defaultCachePolicy → CachePolicy
-
Default cache policy for requests.
final
-
defaultHeaders
→ Map<
String, String> -
Default headers for all requests.
final
- defaultMaxRetries → int
-
Default retry attempts for retryable requests.
final
- defaultTtl → Duration?
-
Default TTL for cached responses.
If null, uses server Cache-Control headers or no expiry.
final
- followRedirects → bool
-
Whether to follow redirects.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxCacheSize → int
-
Maximum cache size in bytes.
Default: 50 MB
final
- maxConcurrentRequests → int
-
Maximum concurrent requests.
Requests beyond this are queued.
final
- maxRedirects → int
-
Maximum redirects to follow.
final
- receiveTimeout → Duration
-
Default timeout for receiving response data.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sendTimeout → Duration
-
Default timeout for sending request data.
final
- validateStatus → bool
-
Whether to validate response status codes.
If true, 4xx/5xx responses throw HttpError.
final
Methods
-
copyWith(
{String? baseUrl, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, CachePolicy? defaultCachePolicy, Duration? defaultTtl, int? maxCacheSize, int? maxConcurrentRequests, Map< String, String> ? defaultHeaders, bool? followRedirects, int? maxRedirects, int? defaultMaxRetries, bool? validateStatus}) → FetchConfig - Create a copy with modified values.
-
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