In Java we can do something like override finalize(), in C++ we can do something like ~Someclass(),
But How can I do it in dart, I read the doc in https://www.dartlang.org/ but did not find answers.
You don't need to actively delete objects in Dart. Dart is a garbage-collected language, so any object that you don't hold any references to will eventually be garbage collected and freed by the runtime system. So all you have to do is to clear any variables you have that reference the object.
There is nothing like a destructor in Dart. JS garbage collector doesn't provide a way to implement this.
This is not supported. There is nothing like a destructor in Dart.
JS garbage collector doesn't provide a way to implement this. See also https://stackoverflow.com/a/20490161/217408 and https://github.com/dart-lang/sdk/issues/3691
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With