HttpConfig constructor
HttpConfig({
- required String baseUrl,
- ResponseParser? responseParser,
- Map<
String, String> ? staticHeaders, - Future<
Map< dynamicHeaderBuilder()?,String, String> > - String? networkErrorKey,
- VoidCallback? on401Unauthorized,
- void onFailure()?,
- Duration errorDeduplicationWindow = const Duration(seconds: 5),
- bool enableLogging = false,
- bool logPrintBody = true,
- LogMode logMode = LogMode.complete,
- bool logShowRequestHint = true,
- BuildContext? contextGetter()?,
- Widget loadingWidgetBuilder(
- BuildContext context
- DeduplicationConfig? deduplicationConfig,
- QueueConfig? queueConfig,
- Map<
String, String> ? serviceBaseUrls, - UnauthorizedRetryConfig? unauthorizedRetry,
- bool disableReceiveTimeout = false,
- Duration? connectTimeout,
- Duration? sendTimeout,
Implementation
HttpConfig({
required this.baseUrl,
ResponseParser? responseParser, // 可选参数,默认使用 StandardResponseParser
this.staticHeaders,
this.dynamicHeaderBuilder,
this.networkErrorKey,
this.on401Unauthorized,
this.onFailure,
this.errorDeduplicationWindow = const Duration(seconds: 5),
this.enableLogging = false,
this.logPrintBody = true,
this.logMode = LogMode.complete,
this.logShowRequestHint = true,
this.contextGetter,
this.loadingWidgetBuilder,
this.deduplicationConfig,
this.queueConfig,
this.serviceBaseUrls,
this.unauthorizedRetry,
this.disableReceiveTimeout = false,
this.connectTimeout,
this.sendTimeout,
}) : responseParser = responseParser ?? StandardResponseParser();