getInstancesAsList method

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

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 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.


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