VmEvaluator class

Navigates the running Flutter app to named routes by evaluating Dart expressions directly inside the app's isolate via the VM service.

Why scope-injection? The Dart VM evaluate() API, when given a library as target, only resolves names that are imported by that library — it does NOT see the library's own top-level declarations. So navigatorKey (defined in nav.dart) cannot be referenced when evaluating IN nav.dart's library context.

Fix: locate the live GlobalKey<NavigatorState> instance on the heap via getInstances(), then inject it as a named variable in evaluate()'s scope parameter. Extension methods (go/goNamed from go_router) are resolved against nav.dart's library context, where they are in scope via the circular import chain: nav.dart → flutter_flow_util.dart → nav.dart export → go_router export.

Constructors

VmEvaluator({required VmService vmService, required String isolateId, String routerType = 'unknown', String? routerVariable})

Properties

canEvaluate bool
no setter
hashCode int
The hash code for this object.
no setterinherited
isolateId String
final
routerType String
final
routerVariable String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vmService → VmService
final

Methods

init() Future<void>
Finds:
Attempt to navigate to route.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited