json_rest_api_client 0.1.0 copy "json_rest_api_client: ^0.1.0" to clipboard
json_rest_api_client: ^0.1.0 copied to clipboard

outdated

Easy to use starting point to implement a client library for a json REST API.

Json REST API Client #

Easy null-safe to use starting point to implement a client library for a json REST API.

Usage #

Create your client

  final dummyApiClientV1 =
      JsonRestApiClient(Uri.parse('http://dummy.restapiexample.com/api/v1'));

Perform a GET request with optional query paramters

Let the JsonRestApiClient do the query component encoding.

  final response1 = await dummyApiClientV1.request(
    'GET',
    '/employee/1',
    queryParameters: {'foo': 'bar'}
  );

Perform any other request and send json data

  final response2 = await dummyApiClientV1.request(
    'POST',
    '/create',
    json: {
      'employee_name': 'Tiger Nixon',
      'employee_salary': 320800,
      'employee_age': 61,
    },
  );

You are able to send arrays too

  final response2 = await dummyApiClientV1.request(
    'PATCH',
    '/sendarray',
    json: ['foo', 'bar'],
  );
2
likes
0
pub points
0%
popularity

Publisher

verified publisherfamedly.com

Easy to use starting point to implement a client library for a json REST API.

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

http

More

Packages that depend on json_rest_api_client