getInstances method

Future<InstanceSet> getInstances(
  1. String isolateId,
  2. String objectId,
  3. int limit, {
  4. bool? includeSubclasses,
  5. bool? includeImplementers,
  6. String? idZoneId,
})

The getInstances RPC is used to retrieve a set of instances which are of a specific class.

The order of the instances is undefined (i.e., not related to allocation order) and unstable (i.e., multiple invocations of this method against the same class can give different answers even if no Dart code has executed between the invocations).

The set of instances may include objects that are unreachable but have not yet been garbage collected.

objectId is the ID of the Class to retrieve instances for. objectId must be the ID of a Class, otherwise an RPCError is returned.

limit is the maximum number of instances to be returned.

If includeSubclasses is true, instances of subclasses of the specified class will be included in the set.

If includeImplementers is true, instances of implementers of the specified class will be included in the set. Note that subclasses of a class are also considered implementers of that class.

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 isolateId refers to an isolate which has exited, then the Collected Sentinel is returned.

See InstanceSet.

This method will throw a SentinelException in the case a Sentinel is returned.

Implementation

Future<InstanceSet> getInstances(
  String isolateId,
  String objectId,
  int limit, {
  bool? includeSubclasses,
  bool? includeImplementers,
  String? idZoneId,
}) =>
    _call('getInstances', {
      'isolateId': isolateId,
      'objectId': objectId,
      'limit': limit,
      if (includeSubclasses != null) 'includeSubclasses': includeSubclasses,
      if (includeImplementers != null)
        'includeImplementers': includeImplementers,
      if (idZoneId != null) 'idZoneId': idZoneId,
    });