monitorNotificationStateChanges method

Future<bool> monitorNotificationStateChanges(
  1. void callback(
    1. AudioPlayerState value
    )
)

Start getting significant audio updates through callback.

callback is invoked on a background isolate and will not have direct access to the state held by the main isolate (or any other isolate).

Implementation

Future<bool> monitorNotificationStateChanges(
  void Function(AudioPlayerState value) callback,
) async {
  // ignore: unnecessary_null_comparison
  if (callback == null) {
    throw ArgumentError.notNull('callback');
  }
  final CallbackHandle handle = PluginUtilities.getCallbackHandle(callback)!;

  await _invokeMethod('monitorNotificationStateChanges', {
    'handleMonitorKey': <dynamic>[handle.toRawHandle()]
  });

  return true;
}