I have a simple JS function that I want to call from a Flutter web application:
<script>
function alertMessage(text) {
alert(text)
}
</script>
How can I achieve this?
main.dart:
void onTap(){
///This is where I want to call the JS function... alertMessage();
}
CodePudding user response:
See dart:js library
import 'dart:js';
main() => context.callMethod('alert', ['Hello from Dart!']);