How to do something before object destruction in Dart?
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