Is there any lib compatible with dart:js for flutter ?

357 views
Skip to first unread message

Diego Garcia

unread,
Jun 19, 2018, 10:39:40 PM6/19/18
to Flutter Dev
Hi guys, I`m trying to use this signalr lib https://github.com/Layoric/SignalDart/blob/master/lib/signal_dart.dart on my flutter app, but its missing the dart:js and I cant find a way to import it,  I`ve looked for some equivalent on flutter but couldnt find ...

Any tips on how to fix it?

I'm getting the follow error when compiling: 
keep receiving the follow error compiler message: dart:js: Error: Not found: dart:js.


Best Regards,
Diego Garcia

Adam Barth

unread,
Jun 19, 2018, 10:47:29 PM6/19/18
to diego....@hqsoftwares.com.br, Flutter Dev
The dart:js library is available when you're running Dart in a web browser.  It's what lets your Dart code interact with other JavaScript code running in the web page.  In Flutter's case, there isn't any JavaScript code around because Flutter isn't based on WebView.

It looks like that library is mostly providing a bridge to a JavaScript implementation of SignalR.  You'd probably need a Dart-based implementation for it to work in Flutter because Flutter doesn't have a JavaScript VM.

Adam

Diego Garcia

unread,
Jun 19, 2018, 10:57:26 PM6/19/18
to Flutter Dev
Thanks Adam, I didnt noted that it was bridging the original implementation only.  

Will look for the signalr documentation and the javascript file to see how to port to dart code only.

Best Regards,
D. Garcia.

Ryan Gonzalez

unread,
Jun 19, 2018, 10:58:54 PM6/19/18
to Diego Garcia, Flutter Dev

That library is a bit old, and I wouldn't be surprised if it doesn't pass Dart 2's strong mode. You'll probably be better off forking it and making whatever changes necessary.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Diego Garcia

unread,
Jun 19, 2018, 11:01:50 PM6/19/18
to Flutter Dev
Yap, I've tried that other one https://pub.dartlang.org/packages/signalr2#-readme-tab- but it has the same dependency on dart:js

Will look on fork it and implement the client part on dart, maybe using websockets.

Best Regards,
D. Garcia
Reply all
Reply to author
Forward
0 new messages