onDispose abstract method
Registers an async cleanup callback to run during dispose.
Callbacks are executed in reverse order of registration.
container.onDispose(() async {
await analytics.flush();
});
Implementation
void onDispose(Future<void> Function() callback);