first commit

This commit is contained in:
kicap
2023-08-18 01:07:57 +08:00
commit 3b437c4f82
320 changed files with 10503 additions and 0 deletions

View File

@ -0,0 +1,34 @@
import 'package:dio/dio.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
// import 'package:flutter_dotenv/flutter_dotenv.dart';
class MyHttpServices {
// final log = getLogger('MyHttpServices');
final _options = BaseOptions(
baseUrl: dotenv.env['api_url']! + dotenv.env['api_keys']!,
connectTimeout: const Duration(seconds: 120),
receiveTimeout: const Duration(seconds: 120),
);
late Dio _dio;
MyHttpServices() {
_dio = Dio(_options);
}
Future<Response> get(String path) async {
try {
return await _dio.get(path);
} on DioException {
rethrow;
}
}
Future<Response> postWithFormData(String path, FormData formData) async {
try {
return await _dio.post(path, data: formData);
} on DioException {
rethrow;
}
}
}