writeFiletoTemporaryDirectory method
This used to write Byte data to file like image is compress or download it will
Implementation
Future<File?> writeFiletoTemporaryDirectory(
{ByteData? data, String? extension = ""}) async {
if (data == null) return null;
final buffer = data.buffer;
Directory tempDir = await pp.getTemporaryDirectory();
String tempPath = tempDir.path;
String uuid = Uuid().v4();
var filePath = tempPath + '/${uuid}.${extension}';
return new File(filePath).writeAsBytes(
buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
}