close method
Flushes out the queue for up to timeout seconds and disable the Hub.
Implementation
Future<void> close() async {
if (!_isEnabled) {
_options.logger(
SentryLevel.warning,
"Instance is disabled and this 'close' call is a no-op.",
);
} else {
// close integrations
for (final integration in _options.integrations) {
await integration.close();
}
final item = _peek();
try {
item.client.close();
} catch (exception, stackTrace) {
_options.logger(
SentryLevel.error,
'Error while closing the Hub',
exception: exception,
stackTrace: stackTrace,
);
}
_isEnabled = false;
}
}