getDownloadPath static method

Future<String> getDownloadPath(
  1. String name
)

Implementation

static Future<String> getDownloadPath(String name) async {
  bool ismac = Platform.isMacOS;
  var spt = ismac ? "/" : "\\";
  var paths = Platform.resolvedExecutable.split(spt);

  var avpaths = paths.sublist(0, paths.length - 1);
  var imPath = normalize(avpaths.join(spt));
  var donwloadpath = join(imPath, 'download', name);
  if (!ismac) {
    final String documentsDirectoryPath = "${Platform.environment['USERPROFILE']}";
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    String pkgName = packageInfo.packageName;
    donwloadpath = join(documentsDirectoryPath, "Documents", ".TencentCloudChat", pkgName, "download", name);
  }
  return donwloadpath;
}