onRequest method
Called when the request is about to be sent.
Implementation
@override
Future<void> onRequest(
RequestOptions options,
RequestInterceptorHandler handler,
) async {
final token = await pref.readToken();
final header = <String, String>{'Authorization': 'Bearer $token'};
if (token.isNotEmpty) {
options.headers.addEntries(header.entries);
}
super.onRequest(options, handler);
}