getByTime method Null safety

ClosedCaption? getByTime(
  1. Duration time
)

Gets the caption displayed at the specified point in time. Returns null if not found.

Implementation

ClosedCaption? getByTime(Duration time) =>
    captions.firstWhereOrNull((e) => time >= e.offset && time <= e.end);