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 _peer
        .sendRequest(_collectAllGarbageMethodName, <String, String>{
      'isolateId': 'isolates/${_appIsolate.numberAsString}',
    });
  } catch (error, stackTrace) {
    throw DriverError(
      'Failed to force a GC due to remote error',
      error,
      stackTrace,
    );
  }
}