writeToFiles function

Future<File> writeToFiles(
  1. ByteData data
)

Implementation

Future<File> writeToFiles(ByteData data) async {
  final buffer = data.buffer;
  Directory? tempDir = await getExternalStorageDirectory();
  String? tempPath = tempDir?.path;

  var filePath =
      tempPath! + '/img.png'; // file_01.tmp is dump file, can be anything
  return new File(filePath)
      .writeAsBytes(buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
}