You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
875 B
Dart
35 lines
875 B
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'dart:async';
|
|
|
|
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:http/http.dart';
|
|
|
|
abstract class IHttpService {
|
|
Future<Response> post(url,
|
|
{Map<String, String> headers, body, Encoding encoding});
|
|
|
|
Future<Response> get(url, {Map<String, String> headers});
|
|
|
|
Future<Response> delete(url, {Map<String, String> headers});
|
|
}
|
|
|
|
class HttpService implements IHttpService {
|
|
@override
|
|
Future<Response> delete(url, {Map<String, String>? headers}) {
|
|
return http.delete(url, headers: headers);
|
|
}
|
|
|
|
@override
|
|
Future<Response> get(url, {Map<String, String>? headers}) {
|
|
return http.get(url, headers: headers);
|
|
}
|
|
|
|
@override
|
|
Future<Response> post(url,
|
|
{Map<String, String>? headers, body, Encoding? encoding}) {
|
|
return http.post(url, headers: headers, body: body, encoding: encoding);
|
|
}
|
|
}
|