Skip to content

[dart2js] Call dynamic function not works after compile js #60872

Closed as not planned
@jimmyshiau

Description

@jimmyshiau
  • Dart 3.8.1
import 'package:web/web.dart';
import 'dart:js_interop';

void main() {
  setInputValue(document.querySelector('#input')!, 'hello world');
}

void setInputValue(Element input, String value) {
  assert(input.isA<HTMLInputElement>() || input.isA<HTMLTextAreaElement>());
  (input as dynamic).value = value;
}
  • It works fine when run with [DDC]
  • But not works after compile to js (Uncaught TypeError: a.sU is not a function)
    • any config can keep function name after compile to js
  • It works fine with Dart 3.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions