VmServiceHeap class

Best-effort handle to the heap of the running test isolate.

Connects like integration_test's timeline API: the address is built from developer.Service.getInfo() as ws://localhost:port/path/ws. This requires the run NOT to sit behind the DDS proxy — with flutter drive, pass --no-dds. In plain flutter test VM runs serverUri == null, so VmServiceHeap.connect returns null and callers degrade gracefully.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
instancesOfClass(String className) Future<int?>
Live instances of className after a forced GC (S1r per-class counter). Counts implementers too — an abstract declared class would otherwise trivially count 0. Null on RPC failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
topClasses({int limit = 30}) Future<List<(String, int)>>
Top retained Dart classes by bytes (after a forced GC) — the "where did the heap delta go" breakdown. Returns (name, bytes) pairs, most bytes first, or an empty list when the profile is unavailable.
toString() String
A string representation of this object.
inherited
usedBytes() Future<int?>
Used heap bytes of the test isolate after a forced GC, or null.
usedBytesMedian({int samples = 3}) Future<int?>
Median of samples usedBytes reads (each forces a GC).

Operators

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

Static Methods

connect() Future<VmServiceHeap?>
Connects to the VM service of the running isolate, or null.