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.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			949 B
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			949 B
		
	
	
	
		
			Dart
		
	
| import 'dart:convert';
 | |
| import 'dart:io';
 | |
| import 'dart:async';
 | |
| 
 | |
| 
 | |
| import 'package:http/http.dart' as http;
 | |
| import 'package:http/http.dart';
 | |
| import 'package:path/path.dart';
 | |
| import 'package:injector/injector.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);
 | |
|   }
 | |
| }
 |