How do I call a function on an element using dart?

Issue

I’m new to dart, and I’m trying to realize how to implement the following javascript code in dart:

$('element1').handsontable(options);

handsontable is a third party library that I want to use.

Solution

With dart:js :

import 'dart:js';

context.callMethod(r'$', ['element1'])
       .callMethod('handsontable', [new JsObject.jsify(options)]);

Answered By – Alexandre Ardhuin

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

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