forceGC method

  1. @override
Future<void> forceGC()
override

Force a garbage collection run in the VM.

Throws UnimplementedError on WebFlutterDriver instances.

Implementation

@override
Future<void> forceGC() async {
  try {
    await _serviceClient.callMethod(_collectAllGarbageMethodName, isolateId: _appIsolate.id);
  } catch (error, stackTrace) {
    throw DriverError(
      'Failed to force a GC due to remote error',
      error,
      stackTrace,
    );
  }
}