registerControlCallback abstract method

Future<void> registerControlCallback(
  1. String control,
  2. List<String> triggers,
  3. void callback(
    1. Event
    )?, {
  4. Map<String, dynamic>? extra,
})

Register a callback function to be called when control events occur.

control is the name of the control (e.g., "ButtonSouth", "AbsoluteX"). triggers is a list of event types to listen for (e.g., "ButtonPress", "ButtonRelease"). If "ButtonChange" is included, it will register callbacks for both "ButtonPress" and "ButtonRelease". callback is the function to call when matching events occur. If null, the callbacks for those triggers will be unregistered.

await myInputController.registerControlCallback(
  "ButtonSouth",
  ["ButtonPress", "ButtonRelease"],
  (Event event) {
    print('Control event: ${event.control}, value: ${event.value}');
  },
);

For more information, see InputController component.

Implementation

Future<void> registerControlCallback(String control, List<String> triggers, void Function(Event)? callback,
    {Map<String, dynamic>? extra});