evaluate method
The evaluate
RPC is used to evaluate an expression in the context of
some target.
targetId
may refer to a Library, Class, or Instance.
If targetId
is a temporary id which has expired, then the Expired
Sentinel is returned.
If targetId
refers to an object which has been collected by the VM's
garbage collector, then the Collected
Sentinel is returned.
If isolateId
refers to an isolate which has exited, then the Collected
Sentinel is returned.
If scope
is provided, it should be a map from identifiers to object ids.
These bindings will be added to the scope in which the expression is
evaluated, which is a child scope of the class or library for
instance/class or library targets respectively. This means bindings
provided in scope
may shadow instance members, class members and
top-level members.
If disableBreakpoints
is provided and set to true, any breakpoints hit
as a result of this evaluation are ignored. Defaults to false if not
provided.
If idZoneId
is provided, temporary IDs for InstancesRef
and
Instances
in the RPC response will be allocated in the specified ID
zone. If idZoneId
is omitted, ID allocations will be performed in the
default ID zone for the isolate. See IDs and Names
for more information
about ID zones.
If the expression fails to parse and compile, then RPCError 113 "Expression compilation error" is returned.
If an error occurs while evaluating the expression, an ErrorRef reference will be returned.
If the expression is evaluated successfully, an InstanceRef reference will be returned.
The return value can be one of InstanceRef or ErrorRef.
This method will throw a SentinelException in the case a Sentinel is returned.
Implementation
Future<Response> evaluate(
String isolateId,
String targetId,
String expression, {
Map<String, String>? scope,
bool? disableBreakpoints,
String? idZoneId,
}) =>
_call('evaluate', {
'isolateId': isolateId,
'targetId': targetId,
'expression': expression,
if (scope != null) 'scope': scope,
if (disableBreakpoints != null)
'disableBreakpoints': disableBreakpoints,
if (idZoneId != null) 'idZoneId': idZoneId,
});