Skip to content

Flutter web 3.27 debug - TextFormField - DartError event_position_helper.dart:70:10 - The targeted input element must be the active input element #160155

@pbeccegato

Description

@pbeccegato

Steps to reproduce

1 Launch the app in Chrome from VSCode
2 Click on textformfield
3 Insert some chars
4 Click outside of the textformfield
5 Click inside the textformfield

Expected results

Write into the textformfield without any errors

Actual results

The debug pause; playing again, into the debug console I've got this error:

DartError: Assertion failed: org-dartlang-sdk:///lib/_engine/engine/pointer_binding/event_position_helper.dart:70:10
targetElement == domElement
"The targeted input element must be the active input element"
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:3     throw_
errors.dart:288
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39               assertFailed
profile.dart:110
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39               _computeOffsetForInputs
profile.dart:110
lib/_engine/engine/pointer_binding/event_position_helper.dart 38:14             computeEventOffsetToTarget
event_position_helper.dart:38
lib/_engine/engine/pointer_binding.dart 1088:30                                 [_convertEventsToPointerData]
pointer_binding.dart:1088
lib/_engine/engine/pointer_binding.dart 1016:9                                  <fn>
pointer_binding.dart:1016
lib/_engine/engine/pointer_binding.dart 948:7                                   <fn>
pointer_binding.dart:948
lib/_engine/engine/pointer_binding.dart 541:9                                   loggedHandler
pointer_binding.dart:541
dart-sdk/lib/_internal/js_dev_runtime/patch/js_allow_interop_patch.dart 212:27  _callDartFunctionFast1

Building the app and test it on webserver, the app works fine.

Code sample

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextFormField(),
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), 
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

various log parts

[   +6 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 10, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 10, params: {streamId: Stdout, includePrivateMembers: false}}}}
[   +2 ms] This app is linked to the debug service: ws://127.0.0.1:49287/m32uQVXqjlM=/ws
[        ] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 11, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 11, params: {streamId: Stderr, includePrivateMembers: false}}}}
[   +3 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 13, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 13, params: {streamId: Isolate, includePrivateMembers: false}}}}
[   +1 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 14, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 14, params: {streamId: Extension, includePrivateMembers: false}}}}
[        ] Debug service listening on ws://127.0.0.1:49287/m32uQVXqjlM=/ws
Connecting to VM Service at ws://127.0.0.1:49287/m32uQVXqjlM=/ws
Connected to the VM Service.
[  +19 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 18, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 18, params: {streamId: Isolate, includePrivateMembers: false}}}}
.....
           {jsonrpc: 2.0, id: 23, error: {code: -32602, message: The stream `ToolEvent` is not supported on web devices}}
[  +42 ms] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 29, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}}
[        ] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 30, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}}
.....
[        ] DevHandler: VmService proxy responded with an error:
           {jsonrpc: 2.0, id: 722, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}}
[   +2 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart
[   +6 ms] ExpressionEvaluator: Evaluating JS: "function () {
             try {
               return   (function() {
                   const dart_sdk = require('dart_sdk');
                   const dart_rti = dart_sdk.dart_rti;
                   const dart = dart_sdk.dart;
                   return dart.fn(() => true, dart_rti._Universe.eval(dart_rti._theUniverse(), "core|bool()", true));
                 }(

                 ))();
             } catch (error) {
               return error.name + ": " + error.message;
             }
           }" with scope: {}
[   +1 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}"
[+5262 ms] DartError: Assertion failed: org-dartlang-sdk:///lib/_engine/engine/pointer_binding/event_position_helper.dart:70:10
           targetElement == domElement
           "The targeted input element must be the active input element"
           dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:3     throw_
           dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39               assertFailed
           dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39               _computeOffsetForInputs
           lib/_engine/engine/pointer_binding/event_position_helper.dart 38:14             computeEventOffsetToTarget
           lib/_engine/engine/pointer_binding.dart 1088:30                                 [_convertEventsToPointerData]
           lib/_engine/engine/pointer_binding.dart 1016:9                                  <fn>
           lib/_engine/engine/pointer_binding.dart 948:7                                   <fn>
           lib/_engine/engine/pointer_binding.dart 541:9                                   loggedHandler
           dart-sdk/lib/_internal/js_dev_runtime/patch/js_allow_interop_patch.dart 212:27  _callDartFunctionFast1

Flutter Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.0, on macOS 15.1.1 24B2091 darwin-arm64, locale it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 16.1)
    ✗ Unable to get list of installed Simulator runtimes.
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.95.3)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consolec: regressionIt was better in the past than it is nowfound in release: 3.27Found to occur in 3.27fyi-text-inputFor the attention of Text Input teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions