Closed Standaa closed 4 years ago
As of right now, you cannot do a service that intercepts all http requests because those are from a different plugin, dart's own: http package.
What this plugin allows you to do, however, is to do an implementation of a customized Client which allows you to intercept all requests that go through said client as per the Using interceptors with Client section specifies. You could also potentially make a global instance of said interceptor but you would have to be on the lookout to close out connections when done.
However, if you really need something like this you could try a more powerful library like the dio package.
Hello, I am looking to build an HttpInterceptor Service in dart, that would act the same way as a service I have built in Angular 2 :
In Angular 2 Ts, I am injecting this service in a CoreModule, and can therefore intercept all requests from all services in that module :
By the examples, it seems the service has to be provided with each Http request. Is there a way to achieve the pattern I am describing above ?
Many thanks.