dio_interceptors 0.0.4+1 copy "dio_interceptors: ^0.0.4+1" to clipboard
dio_interceptors: ^0.0.4+1 copied to clipboard

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()))

14
likes
20
pub points
55%
popularity

Publisher

unverified uploader

Implements interceptors for you use on Dio package.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter

More

Packages that depend on dio_interceptors