Skip to content

[3.35.1] No events are received from KeyboardListener when using a Korean input method (IME) with external barcode scanner. #173818

@baka9131

Description

@baka9131

Steps to reproduce

When using KeyboardListener, character key events are triggered correctly with the English keyboard (IME).
However, when using the Korean IME, no events are received at all.

This issue did not occur in Flutter 3.22.2, but after migrating to Flutter 3.35.1, KeyboardListener no longer works properly with the Korean input method.

Additionally, this issue does not occur in the master channel version 3.33.0-1.0.pre-1299.

Could you please take a look at this issue?

Expected results

Key events — for character keys — should be accurately detected, regardless of the active input method, including Korean, Japanese, and Chinese IMEs.

Actual results

When using Korean, Japanese, or Chinese IMEs, KeyboardListener does not receive any key events. As a result, key handling logic that works with the English IME completely fails for these input methods.

Code sample

Code sample
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(
    MaterialApp(
      title: 'Flutter Demo',
      home: const MyHomePage(title: 'Flutter Demo KeyboardListener'),
    ),
  );
}

class MyHomePage extends StatefulWidget {
  final String title;
  const MyHomePage({super.key, required this.title});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final FocusNode focusNode = FocusNode();
  String _text = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Column(
        children: [
          /// Text
          Text(_text),

          /// Change KeyBoard Language.
          SizedBox(width: 30, child: TextField()),

          /// Event Listener
          KeyboardListener(
            autofocus: true,
            focusNode: focusNode,
            onKeyEvent: (event) {
              if (event.runtimeType == KeyDownEvent) {
                log('event character: ${event.character}');
                setState(() {
                  if (event.character != null) {
                    _text += event.character!;
                  }
                });
              }
            },
            child: ElevatedButton(
              onPressed: () {
                focusNode.requestFocus();
                setState(() {
                  _text = '';
                });
              },
              child: Text('clear & focus'),
            ),
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
2025-08-15.9.56.07.mp4

Logs

Logs
[log.txt](https://github.com/user-attachments/files/21782368/log.txt)

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-arm64, locale
    ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsplatform-androidAndroid applications specificallyteam-text-inputOwned by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions