onCommand method

VoidCallback onCommand(
  1. void callback(
    1. NativeCommand
    )
)

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);
}