writeToFile method

  1. @override
Future<File?> writeToFile(
  1. ByteData data, {
  2. String name = "instrument.sf2",
})
override

Implementation

@override
Future<File?> writeToFile(ByteData data,
    {String name = "instrument.sf2"}) async {
  if (kIsWeb) return null;
  final buffer = data.buffer;
  final directory = await getApplicationDocumentsDirectory();
  final path = "${directory.path}/$name";
  return File(path).writeAsBytes(
      buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
}