How to do something before object destruction in Dart?

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.


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

链接地址: http://www.djcxy.com/p/27780.html

上一篇: 如何使用Spring Cloud AWS连接到S3?

下一篇: 如何在飞镖物体破坏前做些事情?