api_service_interceptor 0.0.2 copy "api_service_interceptor: ^0.0.2" to clipboard
api_service_interceptor: ^0.0.2 copied to clipboard

A Flutter package for API request with Api Service interceptor

api_service_interceptor #

A Flutter package that will help for fetching and passing data to the server.

API Service Interceptor #

pub package

How ApiServiceInterceptor Works #

ezgif com-animated-gif-maker

Installation #

Add dependency for package on your pubspec.yaml:

    dependencies:
      api_service_interceptor: latest

or

flutter pub add api_service_interceptor

Usage #


final ApiServiceInterceptor apiServiceInterceptor;

Future<ApiResponseModel> loginUser(
      {required String email, required String password}) async {

    String url = "-------- use your api url ---------";

    Map<String, String> bodyParams = {
      "email": email,
      "password": password
    };

    Map<String, String> headers = {'Content-Type': 'application/json'};

    ApiResponseModel responseModel = await apiServiceInterceptor.requestToServer(
        requestUrl: url,
        requestMethod: ApiRequestMethod.postMethod,
        bodyParams: jsonEncode(bodyParams),
        headers: headers
    );

    return responseModel;
}

Additional Information #

This package is built on "http", "http_parser" and "shared_preferences". When we use "api_service_interceptor" package than we also use "shared_preferences" package.

12
likes
0
points
103
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for API request with Api Service interceptor

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, http_parser, shared_preferences

More

Packages that depend on api_service_interceptor