6

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.

Simon Jentsch
  • 668
  • 5
  • 10

1 Answers1

7

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

Günter Zöchbauer
  • 490,478
  • 163
  • 1,733
  • 1,404
  • 1
    That helped, thank you! Though I have to select the right File as the context if I want to call own functions, otherwise there will be thrown an exception. – Simon Jentsch Jul 31 '14 at 14:51