startDownload method

Future<void> startDownload(
  1. PlayerResource playerResource,
  2. int trackIndex
)

Implementation

Future<void> startDownload(
    PlayerResource playerResource, int trackIndex) async {
  _playerResource = playerResource;
  _trackIndex = trackIndex;
  final map = HashMap();
  map[Constant.KEY_PLAYER_RESOURCE] = playerResourceToJson(playerResource);
  map[Constant.KEY_TRACK_INDEX] = trackIndex;
  try {
    await methodChannel.invokeMethod(Constant.METHOD_START_DOWNLOAD, map);
    isDownloadStarted = true;
  } on PlatformException catch (_) {}
}