onRequest method
Future<void>
onRequest(
- Uri url,
- HttpMethod method,
- Map<
String, String> headers, - dynamic body,
override
Called before a request is sent
Implementation
@override
Future<void> onRequest(
Uri url,
HttpMethod method,
Map<String, String> headers,
dynamic body,
) async {
final token = await tokenProvider();
if (token != null && token.isNotEmpty) {
headers[headerName] = '$tokenPrefix $token';
}
}