getMusicSheetFile method

Future<File> getMusicSheetFile(
  1. String assetPath,
  2. String filename,
  3. ApiBase api
)

Implementation

Future<File> getMusicSheetFile(
    String assetPath, String filename, ApiBase api) async {
  assetPath = 'assets/musicsheets/happy_birthday.xml';
  filename = 'happy_birthday.xml';
  final byteData = await rootBundle.load(assetPath);
  final tempDir = await getTemporaryDirectory();
  final file = File('${tempDir.path}/$filename');
  await file.writeAsBytes(byteData.buffer.asUint8List());

  await api.uploadMusicSheet("Happy Birthday", "Celebration", file.path);
  print("UPLOAD FILE");
  return file;
}