saveToFile method Null safety

Future<String> saveToFile(
  1. String url,
  2. String type
)

Implementation

Future<String> saveToFile(String url, String type) async {
  if (this.isNotEmpty) {
    String path = await ModernFormFileHelper.getFilePathFromUrl(url, type);
    bool exist = await url.isSaveinDeviceFromUrl(type);
    if (!exist) {
      await ModernFormFileWriteStatic.writeAsBytes(path, this);
    }
    return path;
  } else {
    return "";
  }
}