Failed `disconnectDevice`
Closed this issue · 2 comments
noboru-i commented
I called MidiCommand.disconnectDevice
after MidiCommand.connectToDevice
.
But I had the following error. (I use a physical iPod touch device.)
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: PlatformException(MESSAGEERROR, Could not parse device id, {id: D567BA7A-A04C-5A5C-828B-307783CC07CB, name: TD-07 MIDI, type: BLE, connected: false}, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
I thought,
Dictionary<String, String>
.But the argument has boolean
connected
.So you may change like
connectToDevice
.
case "disconnectDevice":
if let deviceInfo = call.arguments as? Dictionary<String, Any> {
if let deviceId = deviceInfo["id"] as? String {
disconnectDevice(deviceId: deviceId)
} else {
result(FlutterError.init(code: "MESSAGEERROR", message: "No device Id", details: call.arguments))
}
result(nil)
} else {
result(FlutterError.init(code: "MESSAGEERROR", message: "Could not parse device id", details: call.arguments))
}
result(nil)
break
Using:
flutter_midi_command: 0.3.0
flutter: 2.0.4
Xcode: 12.4
mortenboye commented
Thank you for reporting this. I will fix it shortly
noboru-i commented
Thank you for fixing at 53c4463#diff-ae77d1639e5ddd3e023bab3e51dd15bac56600db5a314b6f8e00f0bc36e18cd7R137-R142 👍