- How to use JS with Flutter Web
- web/app.js 생성, 내부에 함수 추가
function alertMessage(text) {
alert(text)
}
- web/index.html
<head>
<script src="app.js" defer></script>
</head>
- main.dart
import 'dart:js' as js;
js.context.callMethod('alertMessage', ['Flutter is calling upon JavaScript!']);
- How to trigger the enter keypress jQuery
var e = $.Event( "keypress", { which: 13 } );
$('#yourInput').trigger(e);