How to use NodeJS package in Flutter web app


I have a Flutter web app that needs to be able to create a virtual midi device. For this, the only option seems to be to use the easymidi NodeJS package. What is the best way of connecting a NodeJS script to a flutter app?


You can connect to javascript from flutter web. Best way is to use dart:js library.

Add your custom js file to web directory a make sure that it’s loaded

    <script src="your.js" defer></script>

For example

function info(text) {

Calling from dart:

import 'dart:js' as js;

js.context.callMethod('info', ['Hello!']);

Answered By – Dominik ┼áimoník

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.