Last updated:
0 purchases
json rest api client
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'));
copied to clipboard
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'}
);
copied to clipboard
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,
},
);
copied to clipboard
You are able to send arrays too
final response2 = await dummyApiClientV1.request(
'PATCH',
'/sendarray',
json: ['foo', 'bar'],
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.