import 'package:dio/dio.dart'; /// Description: http util /// Time : 09/04/2023 Monday /// Author : liuyuqi.gov@msn.cn class HttpUtil { static const String BASE_URL = "http://"; static const int CONNECT_TIMEOUT = 10000; static const int RECEIVE_TIMEOUT = 3000; static HttpUtil? _instance; static Dio? _dio; static HttpUtil getInstance() { _instance ??= HttpUtil(); return _instance!; } Future> get(String url, {Map? params}) async { Response response = await _dio!.get(url, queryParameters: params); return response.data; } Future> post(String url, {Map? params}) async { Response response = await _dio!.post(url, data: params); return response.data; } } class ErrorCode { int code; String msg; ErrorCode(this.code, this.msg); ErrorCode.fromJson({this.code = 0, this.msg = ""}); Map toJson() { return { 'code': code, 'msg': msg, }; } }