saveFileByte static method

Future<bool> saveFileByte(
  1. String fileName,
  2. ByteData data
)

This method saves the given ByteData object to the file with the given fileName in the application documents directory.

Implementation

static Future<bool> saveFileByte(String fileName, ByteData data) async {
  final buffer = data.buffer;
  await File(await getFilePath(fileName)).writeAsBytes(
      buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
  return true;
}