InputHandler class abstract Input
Defines a handler that processes InputEvents and produces ResponseInputs.
Implementations are responsible for interpreting user input and returning an appropriate ResponseInput describing how the app should respond (e.g., exit, redraw components, or ignore the input).
Lifecycle
- An
InputHandler
instance typically lives for as long as its owning component is active. - The handleInput method is called whenever a new InputEvent needs to be processed.
Example
class QuitOnEscapeHandler extends InputHandler {
@override
ResponseInput handleInput(InputEvent event) {
if (event is KeyEvent && event.code == KeyCode.escape) {
return ResponseInput(commands: ResponseCommands.exit, handled: true);
}
return ResponseInput.ignored();
}
}
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
handleInput(
InputEvent event) → ResponseInput - Processes an incoming InputEvent and returns a ResponseInput describing the result of handling it.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited