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.


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

Answered By – Günter Zöchbauer

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.