dispose method Null safety
inherited
Release the resources used by this object. The object is no longer usable after this method is called.
EngineLayers indirectly retain platform specific graphics resources. Some of these resources, such as images, may be memory intensive. It is important to dispose of EngineLayer objects that will no longer be used as soon as possible to avoid retaining these resources until the next garbage collection.
Once this EngineLayer is disposed, it is no longer eligible for use as a
retained layer, and must not be passed as an oldLayer
to any of the
SceneBuilder methods which accept that parameter.
This can't be a leaf call because the native function calls Dart API (Dart_SetNativeInstanceField).
Implementation
@override
void dispose() {
assert(_nativeLayer != null, 'Object disposed');
_nativeLayer!.dispose();
assert(() {
_nativeLayer = null;
return true;
}());
}