Skip to content

Flutter Web on Windows; Using Windows Clipboard History Freezes Application With Pasting Text into TextFormField #97582

@longtimedeveloper

Description

@longtimedeveloper

Steps to Reproduce

  1. On a computer running Windows, Open Windows Settings
  2. Search for Clipboard
  3. Enable Clipboard History as seen in this image.

image

  1. Create a new Flutter application.
  2. Replace main.dart code with the below Code.
  3. Selected Chrome as the device
  4. Copy some text into your clipboard
  5. Run in the application using Debug mode (Start Debugging in VS Code)
  6. Using the mouse, click the TextFormField
  7. Press Windows Logo Key + Alt.
  8. Click the text you copied into the clipboard
  9. App will freeze.

If you repeat the above steps and run the application without debugging, assert messages will appear in the terminal Debug Console.

NOTE: Windows Clipboard History feature works normally when running on Windows and Andriod.

Expected results:
Text is pasted into the TextFormField

Actual results:
Chrome application freezes. You'll be unable to edit any text. Nothing appears in the terminal Debug Console. There have been times when I had to restart VS Code after this happens because the keyboard can't be used to edit code.

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chrome Issue With Windows Clipboard History',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Chrome Issue With Windows Clipboard History'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextFormField(),
          ],
        ),
      ),
    );
  }
}
Logs
This Chrome log is only rendered when running in NON-DEBUG mode.  In DEBUG mode, applicaiton freezes, no log it outputted.

Error: Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/keyboard_binding.dart:352:16
result != null
"Invalid modifier location: Control, 0"
    at Object.throw_ [as throw] (http://localhost:64409/dart_sdk.js:5063:11)
    at Object.assertFailed (http://localhost:64409/dart_sdk.js:4988:15)
    at http://localhost:64409/dart_sdk.js:170042:39
    at _engine.KeyboardConverter.new.[_handleEvent] (http://localhost:64409/dart_sdk.js:170048:25)
    at _engine.KeyboardConverter.new.handleEvent (http://localhost:64409/dart_sdk.js:170134:27)
    at http://localhost:64409/dart_sdk.js:169775:76
    at loggedHandler (http://localhost:64409/dart_sdk.js:169752:18)
Error: Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/keyboard_binding.dart:352:16
result != null
"Invalid modifier location: Control, 0"
    at Object.throw_ [as throw] (http://localhost:64409/dart_sdk.js:5063:11)
    at Object.assertFailed (http://localhost:64409/dart_sdk.js:4988:15)
    at http://localhost:64409/dart_sdk.js:170042:39
    at _engine.KeyboardConverter.new.[_handleEvent] (http://localhost:64409/dart_sdk.js:170048:25)
    at _engine.KeyboardConverter.new.handleEvent (http://localhost:64409/dart_sdk.js:170134:27)
    at http://localhost:64409/dart_sdk.js:169776:74
    at loggedHandler (http://localhost:64409/dart_sdk.js:169752:18)

>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19043.1466], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.9)
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.63.2)
[√] Connected device (3 available)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specificallyplatform-windowsBuilding on or for Windows specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions