Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access Dart functions/variables from the Dartium DevTool Console?

In JavaScript you can access global variables and functions from the DevTool console (e.g. to call a function manually).

I tried to do this in Dartium, but I always get a reference error.

I tried following variations:

testFunc () {
    return "test";
}

var testFunc2 = () {
    return "test";
}

void main() {
    var testFunc3 () {
        return "test";
    }
}

but none can be called via DevTool console of Dartium.

like image 605
Simon Jentsch Avatar asked Jul 30 '14 14:07

Simon Jentsch


1 Answers

You need to select a Dart context.
When you open devtools > Console tab there is <top frame> selected by default.
You need to switch to a Dart context like dart:core.
As far as I remember it doesn't matter which Dart context is selected, just one of the Dart contexts.

enter image description here

like image 107
Günter Zöchbauer Avatar answered Oct 15 '22 02:10

Günter Zöchbauer