Listen to JS object's events from Dart


I need to listen to ready events from a JS object (wavesurfer.js). I initialize the object with:

var wavesurfer = context['WaveSurfer'];

And call its init function with:

wavesurfer.callMethod('init', [mapOptions]);

But I’m unable to listen on ready events like in this JS code:

wavesurfer.on('ready', function () {;

I found solutions for similar problems like here but all are using functions that appear deprecated such as js package‘s scoped() and Callback.many().

Any pointers are appreciated.


With dart:js :

wavesurfer.callMethod('on', ['ready', () {

Answered By – Alexandre Ardhuin

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *