getInstancesAsList method

Future<InstanceRef> getInstancesAsList(
  1. String isolateId,
  2. String objectId, {
  3. bool? includeSubclasses,
  4. bool? includeImplementers,
  5. String? idZoneId,
})

The getInstancesAsList RPC is used to retrieve a set of instances which are of a specific class. This RPC returns an InstanceRef corresponding to a Dart List<dynamic> that contains the requested instances. This List is not growable, but it is otherwise mutable. The response type is what distinguishes this RPC from getInstances, which returns an InstanceSet.

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.

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.

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

Implementation

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