listenShutdown method
Future<void>
listenShutdown({
- FutureOr<
void> onShutdown(- AudioIsolateShutdownReason reason,
- Object? e,
- StackTrace? stackTrace
Implementation
Future<void> listenShutdown({FutureOr<void> Function(AudioIsolateShutdownReason reason, Object? e, StackTrace? stackTrace)? onShutdown}) async {
try {
final reason = await _shutdownCompleter.future;
await onShutdown?.call(reason, null, null);
} catch (e, stack) {
await onShutdown?.call(AudioIsolateShutdownReason.exception, e, stack);
} finally {
await _requestSubscription?.cancel();
_requestSubscription = null;
}
}