How to get "this" from a callback in Dart: js

I am trying to integrate highcharts as a component of AngularDart. Js interop works like a charm, but I ran into a problem that I cannot overcome.

Highcharts allows the user to provide callbacks to customize certain types of behavior. For example, a callback to format chart tooltips. This is a formatting example written in javascript:

formatter: function() {
            return 'The value for <b>'+ this.x +
                '</b> is <b>'+ this.y +'</b>';
        }

I have a formatter function in Dart. The function is called correctly, but I don’t know how to get the "this" object to get the data I need.

Can someone help me?

+4
source share

Source: https://habr.com/ru/post/1541356/


All Articles