getSubtitleForCurrentPosition method

Subtitle? getSubtitleForCurrentPosition(
  1. Duration position
)

Implementation

Subtitle? getSubtitleForCurrentPosition(Duration position) {
  // print("----->${caption.value.length}");
  // ignore: invalid_use_of_protected_member
  for (var subtitle in caption.value) {
    // print("----->${subtitle.start}---${subtitle.end}");
    if (position >= subtitle.start && position <= subtitle.end) {
      return subtitle;
    }
  }
  return null;
}