I frequently come across the Interceptor base class in the dart docs, but the link is broken. Does anyone know what is an interceptor?
For instance the Storage class derives from Interceptor http://api.dartlang.org/docs/releases/latest/dart_html/Storage.html
Whenever a request is made, the interceptors handle it in between. They can also identify the response by performing Rxjs operators. The interceptors do not initiate the handle method and handle the requests at their level. The interceptor is used to perform various functions and methods to perform specific tasks.
Interceptors as the name suggest, intercept something. It basically allows us to intercept incoming or outgoing HTTP requests using the HttpClient. Interceptors are a way to do some work for every single HTTP request or response.
Add Dio as a network client package in the dependency section of your pubspec. yaml file and import it. Create a Dio object, you can use the log interceptors to read while making HTTP calls. This interceptor will help you create all the logs while making the HTTP request and response as well.
When you open the declaration of any such type in DartEditor, it turns out that it is actually derived from NativeFieldWrapperClass1
class.
NativeFieldWrapperClass1
class is used as the base class for types which have a native implementation in environments which embed Dart VM, e.g. classes which wrap DOM elements - canvas DOM element is implemented in browser and wrapped into CanvasElement
Dart class.
Instances of such types have their peers in native implementation (CanvasElement
instance has native peer C/C++ object in the browser). Deriving from NativeFieldWrapperClass1
ensures they have a slot where embedders can store a pointer to the peer object - native data. This is done with embedder API (Dart_SetNativeInstanceField
function).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With