rest_api_package 1.0.0+1
rest_api_package: ^1.0.0+1 copied to clipboard
Do you want an easy way to handle requests without repeating yourself? rest-api-package offers you that! An easy way to handle Rest-API requests
import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:rest_api_package/rest_api_package.dart';
import 'models/cat_fact_model.dart';
void main() async {
final restApiHttpService = RestApiHttpService(
Dio(),
'https://cat-fact.herokuapp.com/',
);
final catFactsRequest = RestApiRequest(
endPoint: 'facts',
requestMethod: RequestMethod.GET,
useNewDioInstance: true,
);
final catFactList = await restApiHttpService.requestAndHandleList(
catFactsRequest,
parseModel: CatFact.fromJson,
);
log('Result: $catFactList');
}