newHeaders method
Adds authorization headers to the client if needed. All methods check if there is a Client as part of the class or if it's null. If it's null it calls this method to check for headers, otherwise it assumes that any authorization information is within the client object
Implementation
@override
Future<Map<String, String>> newHeaders(Map<String, String>? headers) async {
headers ??= <String, String>{};
if (client?.credentials.accessToken != null) {
headers['Authorization'] = 'Bearer ${client!.credentials.accessToken}';
}
headers.addAll(authHeaders ?? <String, String>{});
return headers;
}