How to make my main Dart app object accessible from browser console?

88 Views Asked by At

I want to debug my app in Dartium, call its methods, like APP.getUserState() from browser console.

With JavaScript I would just make APP global this way window.APP = myAPP.

How do I achieve the same effect with Dart app?

1

There are 1 best solutions below

0
Günter Zöchbauer On BEST ANSWER

web/index.dart

class X {
  static void p() => print('xxx');
  static void q(String a) => print(a);
}

void main() {
  // your application code
}

Ensure the context is set to Dart and start using Dart classes:

enter image description here