Regarding the accessToken, you may have a shared HttpClient object that handles all http requests. This is to make your ChangeNotifiers do not care about adding the Authorization Header in every function because it shouldn't. To achieve this, make your Info class depend on a custom HttpClient object of your creation. Then use this HttpClient object inside your ChangeNotifier to make requests. This custom HttpClient can now intercept any request and add the Authorization Header automatically if it is available.
https://github.com/ikema77/flutter_auth/blob/0b86b7d22c968fdd363c173abcfbd6dd2510f919/lib/main.dart#L21-L22
Regarding the
accessToken
, you may have a sharedHttpClient
object that handles all http requests. This is to make yourChangeNotifiers
do not care about adding the Authorization Header in every function because it shouldn't. To achieve this, make your Info class depend on a customHttpClient
object of your creation. Then use thisHttpClient
object inside yourChangeNotifier
to make requests. This customHttpClient
can now intercept any request and add the Authorization Header automatically if it is available.