http_services 3.0.1 copy "http_services: ^3.0.1" to clipboard
http_services: ^3.0.1 copied to clipboard

A Dart package based on Dio that provides base models to handle HTTP services requests.

example/main.dart

import 'package:http_services/http_services.dart';

import 'todos_service.dart';

void main() async {
  final dio = Dio(
    BaseOptions(
      baseUrl: 'https://jsonplaceholder.typicode.com/',
    ),
  );

  final service = TodosService(dio);

  try {
    print("Requesting data...");
    final response1 = await service.getTodo(1);
    print(
      "user id: ${response1.userId}\n"
      "id: ${response1.id}\n"
      "title: ${response1.title}\n"
      "completed: ${response1.completed}",
    );
    final response2 = await service.postBoh();
    print(response2);
  } on HttpServiceException catch (e) {
    print('Service exception: ${e.runtimeType}');
  }
}
12
likes
160
points
170
downloads

Publisher

verified publishermagicleon94.dev

Weekly Downloads

A Dart package based on Dio that provides base models to handle HTTP services requests.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, disposable_object, meta

More

Packages that depend on http_services