cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -27,7 +27,7 @@ Future<dynamic> requestAPI(String path, method,
if (token != null) {
headers["Token"] = token;
}
if (devInfo != null && devInfo.deviceID != null && deviceName != null) {
if (devInfo.deviceID != null) {
headers["Device"] = devInfo.deviceID ?? "" + ":" + deviceName;
}
headers["Project-ID"] = Config.instance.reportProjectID;
@@ -148,8 +148,8 @@ typedef OnDownloadDone(File file);
// if token is null
Future<dynamic> requestDownload(String path, method,
{dynamic payload,
required String token,
required String url,
required String? token,
required String? url,
required String filePath,
OnDownloadDone? onDownloadDone}) async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
@@ -187,7 +187,7 @@ Future<dynamic> requestDownload(String path, method,
fileName = cd.substring(cd.indexOf("=") + 1);
}
var file = filePath + "/" + fileName;
// var file = filePath + "/" + fileName;
var fileSave = new File(filePath + "/" + fileName);
response.listen((d) => _downloadData.addAll(d), onDone: () async {
await fileSave.writeAsBytes(_downloadData);