validateYlSubtitleOffset function
Whole milliseconds within ±7 days, checked before wire conversion.
Implementation
void validateYlSubtitleOffset(Duration offset) {
const bound = 7 * 24 * 60 * 60 * 1000000;
if (offset.inMicroseconds < -bound ||
offset.inMicroseconds > bound ||
offset.inMicroseconds % 1000 != 0) {
throw ArgumentError(
'Subtitle offset must be whole milliseconds within seven days.',
);
}
}