dispose method

Future<void> dispose()

Dispose all recorded frames and result images.

This method must be called before the test case ends (usually as a tear down callback) to properly deallocate the images.

After this method is called, there will be no frames to collate.

Implementation

Future<void> dispose() async {
  final List<_AsyncImage> targets = <_AsyncImage>[
    ..._recordedFrames,
    ..._results,
  ];
  _recordedFrames.clear();
  _results.clear();
  for (final ui.Image image in await _AsyncImage.resolveList(targets)) {
    image.dispose();
  }
}