RestDataProvider<T> constructor
RestDataProvider<T> ({
- required String urlBuilder(
- RouteDataContext context
- required JsonEntityMapper<
T> mapper, - Client? client,
- Map<
String, String> headers = const {}, - Duration timeout = const Duration(seconds: 10),
- int maxResponseSizeBytes = 5 * 1024 * 1024,
- int maxRetries = 2,
- String entityTag = 'rest_api',
- SsrfGuard ssrfGuard = const SsrfGuard(),
Implementation
RestDataProvider({
required this.urlBuilder,
required this.mapper,
http.Client? client,
this.headers = const {},
this.timeout = const Duration(seconds: 10),
this.maxResponseSizeBytes = 5 * 1024 * 1024, // 5MB limit
this.maxRetries = 2,
this.entityTag = 'rest_api',
this.ssrfGuard = const SsrfGuard(),
}) : client =
client ?? ssrfGuard.createPinnedClient(connectionTimeout: timeout);