destroy method
void
destroy()
Destroy an entity which will lead to following steps:
- Remove all components
- Remove from the system
- Set
isDestroyed
totrue
Implementation
void destroy() {
for (var comp in components.value.values.toList()) {
var _ = this - comp.runtimeType;
}
system.destroyed(this);
// Add to sink that we are destroyed.
isDestroyed.add(true);
isDestroyed.close();
}