Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
How to listen to a Javascript EventEmitter from Flutter web

I am trying to port the Twilio Conversations Javascript SDK to Dart/Flutter using package:js.

The twilio SDK: http://media.twiliocdn.com/sdk/js/conversations/releases/2.0.1/docs/classes/Client.html

In Javascript, CDN script allows access to global Twilio.Conversations. You then call Twilio.Conversations.Client(token), which returns a ReplayEventEmitter, their extension of an EventEmitter. You then listen to the events coming out to know first when initialization/connection is complete and then when messages or conversations are coming through.

Using package:js, I start with barebones:

@JS('Twilio.Conversations')
library twilio_conversations;

import 'package:js/js.dart';

external TwilClient get client;

@JS('Client')
Class TwilClient {
  external TwilClient(String token)
}

And this is easy to conceptualize adding methods to, but is there a straightforward way to turn the event emitter into a Dart class? Or would it be better to try to import the JS ReplayEventEmitter class, have 'Client' returned as the javascript object, then have the events coming out of it channeled into Dart code?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!