SubtitleProvider.fromString constructor
SubtitleProvider.fromString({
- required String data,
- required SubtitleType type,
Use this provider for string to generate a subtitles. You should provide the current format type of this subtitle. for example:
String subtitleData = """
WEBVTT
00:01.000 --> 00:04.000
- Never drink liquid nitrogen.
00:05.000 --> 00:09.000
- It will perforate your stomach.
- You could die.
""";
// Using [StringSubtitle] class.
StringSubtitle fileSub = new StringSubtitle(
data: subtitleData,
type: SubtitleType.vtt,
);
// Using factory constructor.
SubtitleProvider fileSub = SubtitleProvider.fromString(
data: subtitleData,
type: SubtitleType.vtt,
);
Implementation
factory SubtitleProvider.fromString({
required String data,
required SubtitleType type,
}) =>
StringSubtitle(
data: data,
type: type,
);