onCommand method
Register a callback to be notified when any command is sent.
Useful for debugging or complex test scenarios.
Implementation
VoidCallback onCommand(void Function(NativeCommand) callback) {
_commandListeners.add(callback);
return () => _commandListeners.remove(callback);
}