removeSubtitle method

List<Subtitle> removeSubtitle(
  1. int trackIndex
)

Implementation

List<Subtitle> removeSubtitle(int trackIndex) {
  // 获取待删除的字幕
  final toBeRemoved =
      subtitles.where((subtitle) => subtitle.index == trackIndex).toList();

  // 删除符合条件的字幕
  subtitles.removeWhere((subtitle) => subtitle.index == trackIndex);

  // 返回被删除的字幕列表
  return toBeRemoved;
}