handleMethodCall method
Implementation
Future<dynamic> handleMethodCall(MethodCall call) async {
switch (call.method) {
case 'play_midi_note':
final int midi = call.arguments['note'];
String _note = tonic.Pitch.fromMidiNumber(midi).toString();
_note = _note.replaceAll('♭', 'b').replaceAll('♯', '#');
js.context.callMethod('playNote', [_note]);
return 'Result: $_note';
case 'stop_midi_note':
final int midi = call.arguments['note'];
String _note = tonic.Pitch.fromMidiNumber(midi).toString();
_note = _note.replaceAll('♭', 'b').replaceAll('♯', '#');
// print('Midi -> $midi/$_note');
js.context.callMethod('stopNote');
return 'Result: $_note';
default:
}
}