dio_interceptors 0.0.4+1

Flutter Android iOS web

Implements interceptors for you use on Dio package.

dio_interceptors #

A interceptors to use on Dio.

INTERCEPTORS #

Interceptor Mock #

You use for mock API requests.


void main() {
  Dio dio = Dio();

  var mockData = {
     "/test" : {
       "name" : "Gabul DEV",
       "site" : "https://gabul.dev"
     }
   };
   dio.interceptors.add(InterceptorMock(mockData));

   void getData() async{
       var res = await dio.get("/test");
      print(res.data["name"])// "Gabul DEV" 
      print(res.data["site"])// "https://gabul.dev"); 
   }
    
    getData();
}

Interceptor Token #

You can use for add JWT all requests

Future<String> token() async{
  //Implements your logic here
  return jwt;
}

dio.interceptors.add(InterceptorToken(token: () async => await token()))

3
likes
100
pub points
68%
popularity

Implements interceptors for you use on Dio package.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

gbrlsavio2@gmail.com

License

unknown (LICENSE)

Dependencies

dio, flutter

More

Packages that depend on dio_interceptors