1

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?

JakesMD
  • 1,646
  • 2
  • 15
  • 35

1 Answers1

1

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

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

For example

function info(text) {
    alert(text)
}

Calling from dart:

import 'dart:js' as js;

js.context.callMethod('info', ['Hello!']);
Dominik Šimoník
  • 1,442
  • 10
  • 17