upgrade packages
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user