init method

Future<void> init (
  1. AudioInfo details
)

Starts the service, playback and sends a notification with given details This command has to be run before any other. The service will stop on itself when playback is done For more details about AudioInfo see the corresponding doc section

Implementation

static Future<void> init(AudioInfo details) async {
  String checkIfNull(String toCheck) {
    if (toCheck == null) {
      return "theGivenResourceIsNull";
    } else {
      return toCheck;
    }
  }

  await _checkIfBound();
  await _nativeChannel.invokeMethod("startService", {
    "title": details.title,
    "channel": details.artist,
    "url": details.url,
    "albumCoverFallback": checkIfNull(details.albumCoverFallback),
    "albumCoverUrl": checkIfNull(details.albumCoverUrl),
    "appIcon": checkIfNull(details.appIcon),
  });
}