What is the dart equivalent of getScript

Issue

What is the Dart equivalent of Jquery getScript (to load javascript from Dart) ?
http://api.jquery.com/jquery.getscript

Thanks for your suggestions.

Solution

I don’t think Dart provides a function that does this.

You can fetch the script using an HttpRequest, create a script element, add the received text to the element and then use Dart-js-Interop to call a JavaScript function.

Alternatively you can add jQuery and call getScript using Dart-js-Interop.

Answered By – Günter Zöchbauer

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.