cleanup code
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -62,7 +62,7 @@ Future<String> uploadStorage(String path, File? file,
|
||||
}
|
||||
|
||||
Future<void> deleteStorageFromUrls(List<String?> urls) async {
|
||||
if (urls == null) return;
|
||||
if (urls.isEmpty) return;
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
if (urls[i] == null) return;
|
||||
await deleteStorageFromUrl(urls[i]!);
|
||||
|
||||
@@ -51,7 +51,7 @@ class NetworkConnectivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (_controller != null && !_controller.isClosed)
|
||||
if (!_controller.isClosed)
|
||||
_controller.sink.add({"isOnline": isOnline});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user