storeDoc function

Future<File?> storeDoc(
  1. Uint8List imgBytes,
  2. String name
)

Implementation

Future<File?> storeDoc(Uint8List imgBytes, String name) async {
  // Write the file
  try {
    var file = await localFile(name, "jaman");
    await file.parent.create(recursive: true);
    // Avoid rewriting already valid cached files
    if (file.existsSync()) {
      try {
        if (file.lengthSync() >= 5) return file;
      } catch (_) {}
    }
    file = await file.writeAsBytes(imgBytes); //u good?
    return file;
  } catch (e) {
    debugPrint("!!! failed to store image: " + e.toString());
    return null;
  }
}