Search code examples
javascriptjquerydartdart-editor

Calling Jquery function in DART lang


I'm trying to convert the following jquery script in DART :

<script>
    (function($){
        $(window).load(function(){
            $(".content").mCustomScrollbar();
        });
    })(jQuery);
</script>

I've wrote the following code in DART :

  js.context
  .callMethod(r'$', ['.content"'])
  .callMethod('mCustomScrollbar');

But it's not working. Any help is appreciated.


Solution

  • Aside the typo in ['.content"'] (instead of ['.content']) it looks good to me if you are using import dart:js; and not import 'package:js/js.dart'.