A Future-based library that allows you to make simple HTTP requests.
This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.
- Getting Started
- Installation
- Initialization
- Usage
- Parameters and Response Logs
- Examples
- License
- Features and bugs
Getting Started
First and foremost, welcome to the easy-to-use service method.
Installation
Add dependency
dependencies:
kd_api_call: ^0.1.0
Initialization
First, import dependeny:
import 'package:kd_api_call/kd_api_call.dart';
Usage
The top-level functions are the simplest method to utilise this module. They let you make individual HTTP queries with a minimum of fuss:
import 'package:kd_api_call/kd_api_call.dart';
APIRequestInfo requestInfo = APIRequestInfo(
url: "https://jsonplaceholder.typicode.com/albums/1",
requestType: HTTPRequestType.GET,
);
Response apiResponse =
await ApiCall.instance.callService(requestInfo: requestInfo);
You can find a complete example here
Parameters and Response Logs
Service Parameters
|-------------------------------------------------------------------------------------------------------------------------
| ApiType :- GET
| URL :- https://jsonplaceholder.typicode.com/albums/1
| Header :- {Content-Type: application/json}
| Params :- null
|-------------------------------------------------------------------------------------------------------------------------
Service Response
|--------------------------------------------------------------------------------------------------------------------------
| API :- https://jsonplaceholder.typicode.com/albums/1
| StatusCode :- 200
| Message :- {"userId": 1, "id": 1, "title": "quidem molestiae enim"
|--------------------------------------------------------------------------------------------------------------------------
Features and bugs
Please file feature requests and bugs at the issue tracker.