dispose method

  1. @override
Future dispose()
override

Destroys/disposes the viewer (including the entire scene). You cannot use the viewer after calling this method.

Implementation

@override
Future dispose() async {
  if (_viewer == null) {
    // we've already cleaned everything up, ignore the call to dispose
    return;
  }
  await setRendering(false);
  await clearEntities();
  await clearLights();
  _destroyViewer();

  _sceneManager = null;
  _viewer = null;

  for (final callback in _onDispose) {
    await callback.call();
  }
  _onDispose.clear();
}