startHeadlessService method
void
startHeadlessService()
this should be called after initiating AudioPlayer only if you want to listen for notification changes in the background. Not implemented on macOS
Implementation
void startHeadlessService() {
if (this == null || playerId!.isEmpty) {
return;
}
// Start the headless audio service. The parameter here is a handle to
// a callback managed by the Flutter engine, which allows for us to pass
// references to our callbacks between isolates.
final CallbackHandle handle =
PluginUtilities.getCallbackHandle(_backgroundCallbackDispatcher)!;
assert(handle != null, 'Unable to lookup callback.');
_invokeMethod('startHeadlessService', {
'handleKey': <dynamic>[handle.toRawHandle()]
});
return;
}