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