subtitle
A library that makes it easy to work with multiple subtitle/caption file formats, written with highly efficient code, highly customizable (90%), supports Null Safety.
0.2.0
2.5K downloads/mo
#4951 most downloaded on pub.dev
dsc-uob/subtitle
What this package is like to depend on
Last release 3 months ago
13 May 2026
Ships fairly regularly
a new release about every 1.1 years
Nearly every release is documented
notes for 4 of 4 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
7 releases · first in 2021
1 release in the last 12 months
see the full history below
Release timeline
7 releases · May 2021 to May 2026
2022
2023
2024
2025
2026
Releases
latest 7-
0.2.013 May 2026Release notes
Open source →Performance
- VTT and SRT parser rewritten as a line-based cue-block parser. The file is split on blank lines and only the
-->timing line is matched with a regex, eliminating the catastrophic backtracking that caused multi-second hangs on large karaoke-style VTT files. (#21) multiDurationSearchis now O(log n + k) — an upper-bound binary search locates the candidate window, then a backwards walk with a precomputed prefix-max-end array terminates as soon as no further active cue is possible.- Cue deduplication runs automatically after parsing and sorting. Same-range cues are collapsed to the longest text; contiguous cues with identical text and a gap ≤ 50 ms are merged into one. This keeps karaoke-style files manageable without losing visible content.
Fixes
- VTT cue identifiers (named cues such as
introorchapter-1) are now parsed correctly — cue names no longer bleed into.data. (#20) - VTT positioning directives (
line:,position:,align:, etc.) on the timing line are silently skipped; only the cue text that follows is extracted. - Network and file fetching now attempt strict UTF-8 decoding first and fall back to Latin-1 for subtitle files served in legacy encodings. (#10)
API additions
Subtitle.copyWith({index, data, start, end})— creates a modified copy of a subtitle cue.
- VTT and SRT parser rewritten as a line-based cue-block parser. The file is split on blank lines and only the
-
0.1.431 Jan 2025Release notes
Open source →- Fix: Resolved issues related to new line handling in subtitle parsers.
- Test: Added comprehensive tests for all subtitle formats. (#18)
- Fix: Corrected regex handling for ttml_subtitle to ensure proper parsing.
- Improvement: Adjusted parsers to maintain \n consistency, aligning with VTT and SRT styles as intended by subtitle authors.
-
0.1.308 Oct 2024Release notes
Open source →- Solved issue with StringSubtitle, see #16 for more.
- Added dispose for SubtitleController, see #11 for more.
- Solved issues #9 and #4 in #12, thanks for (@fadone).
-
0.1.024 Aug 2023Release notes
Open source →- Addressed an issue with subtitle parsing (srt) that was affecting certain cases. This contribution is credited to @sahanForaty. Refer to issue #6.
- Resolved a network subtitle problem, contributed by @thecarry98. See issue #8.
- Corrected the issue associated with the unclosed HttpClient in the network subtitle handling.
- Added SRT format example.
-
0.1.0-beta.309 Nov 2021 pre-releaseRelease notes
Open source →- Fix srt bug.
- Remove path package from dependency.
- Rewrite and enhance regular expressions.
-
0.1.0-beta.223 May 2021 pre-releaseRelease notes
Open source →- Add
SubtitleControllerand its feature like:- Binary search for single search by providing the duration.
- Multi result search by providing the duration.
- Re-architect the files of project.
- Update regex of
VttRegexandSrtRegex. - Fix
SubtitleParserbug when decoding the subtitles. - You can normalize the subtitle text data while decoding, like remove css styles.
- Manual provide of the
SubtitleType, or leave it to detected auto. - Fix
dart:iobug to support dart js and flutter web by usinguniversal_iopackage. - Reducing non-required dependency
httppackage. - 3 examples added.
Release notes
Open source →- Add
SubtitleControllerand its feature like:- Binary search for single search by providing the duration.
- Multi result search by providing the duration.
- Re-architect the files of project.
- Update regex of
VttRegexandSrtRegex. - Fix
SubtitleParserbug when decoding the subtitles. - You can normalize the subtitle text data while decoding, like remove css styles.
- Manual provide of the
SubtitleType, or leave it to detected auto. - Fix
dart:iobug to support dart js and flutter web by usinguniversal_iopackage. - Reducing non-required dependency
httppackage. - 3 examples added.
- Add
-
0.1.0-beta.120 May 2021 pre-releaseRelease notes
Open source →- SubtitleProvider: Simplifies fetching subtitle file data from multiple sources.
- SubtitleRepository: Deals with the platform directly to get or download the required data and submit it to the provider.
- SubtitleParser: Used to analyze and convert subtitle files into software objects that are viewable and usable.
- CustomSubtitleParser: Customizable subtitle parser, for custom regexes.
- SubtitleRegexObject: Responsible for providing the necessary expression for the purpose of decoding the content of subtitle files, has 4 children:
- VttRegex: WebVTT regexp.
- SrtRegex: SubRip regexp.
- TtmlRegex: TTML or DFXP regex
- CustomRegex: User define regexp.
- SubtitleObject: Store the subtitle file data and its format type.
- Initial version, created by MuhmdHsn313
Release notes
Open source →- SubtitleProvider: Simplifies fetching subtitle file data from multiple sources.
- SubtitleRepository: Deals with the platform directly to get or download the required data and submit it to the provider.
- SubtitleParser: Used to analyze and convert subtitle files into software objects that are viewable and usable.
- CustomSubtitleParser: Customizable subtitle parser, for custom regexes.
- SubtitleRegexObject: Responsible for providing the necessary expression for the purpose of decoding the content of subtitle files, has 4 children:
- VttRegex: WebVTT regexp.
- SrtRegex: SubRip regexp.
- TtmlRegex: TTML or DFXP regex
- CustomRegex: User define regexp.
- SubtitleObject: Store the subtitle file data and its format type.
- Initial version, created by MuhmdHsn313