static Future<void> writeToFile(ByteData data, String path) { final buffer = data.buffer; return new File(path).writeAsBytes( buffer.asUint8List(data.offsetInBytes, data.lengthInBytes)); }