Implementation
@override
Stream<GamePadControllerEventData> get events async* {
if (Dart.isWeb) {
return;
}
// if (Dart.isDesktop) {
// Gamepads.events;
await for (GamepadEvent event in Gamepads.events) {
// Gamepads.events.listen((GamepadEvent event) {
GamePadControllerEventKeyType gamePadControllerEventKeyType = GamePadControllerEventKeyType.analog;
if (event.type == KeyType.button) {
gamePadControllerEventKeyType = GamePadControllerEventKeyType.button;
}
yield GamePadControllerEventData(
gamepadId: event.gamepadId,
timestamp: event.timestamp,
type: gamePadControllerEventKeyType,
key: event.key,
value: event.value,
);
}
// }
}