This is a simplified implementation of Dio it targets developers that need to quickly have http implementation in their applications.
This package has only four (4) methods for now, viz are:
- getRequest
- postRequest
- updateRequest
- deleteRequest
Kindly initialize the DioClient object with your baseUrl and start accessing the methods.
///[baseUrl]
const baseUrl = 'https://jsonplaceholder.typicode.com';
///[Dioclient] object instantiation
final dioClient = DioClient(baseUrl: baseUrl);
try{
///calling of the methods
final response = await dioClient.getRequest(path: '/posts');
if(response.statusCode == 200){
debugPrint(response.data);
}else{
debugPrint(response.statusMessage);
}
}on Exception catch(e){
debugPrint('Error: $e');
}
More information can be found on Website Credits goes to Dio contributors as this package depends on it.