upgrade packages

This commit is contained in:
tzw
2024-01-09 13:11:22 +06:30
parent cbd8ddad08
commit 3e1c61a9f6
32 changed files with 193 additions and 150 deletions

View File

@@ -16,13 +16,8 @@ final log = Logger('requestAPI');
// request makes http request
// if token is null
Future<dynamic> requestAPI(
String path,
method, {
dynamic payload,
String? token,
String? url,
}) async {
Future<dynamic> requestAPI(String path, method,
{dynamic payload, String? token, String? url, int? networkTimeout}) async {
DevInfo devInfo = await DevInfo.getDevInfo();
String deviceName = "${devInfo.model}(${devInfo.id})";
@@ -33,15 +28,15 @@ Future<dynamic> requestAPI(
headers["Token"] = token;
}
if (devInfo != null && devInfo.deviceID != null && deviceName != null) {
headers["Device"] = devInfo.deviceID??"" + ":" + deviceName;
headers["Device"] = devInfo.deviceID ?? "" + ":" + deviceName;
}
headers["Project-ID"] = Config.instance.reportProjectID;
BaseOptions options = new BaseOptions(
method: method,
baseUrl: url == null ? Config.instance.apiURL : url,
connectTimeout: 10000,
receiveTimeout: 60000,
connectTimeout: Duration(milliseconds: networkTimeout ?? 50000),
receiveTimeout: Duration(milliseconds: networkTimeout ?? 50000),
headers: headers,
);
log.info("baseUrl:${options.baseUrl}, path:$path");