NetworkSubtitle class
Network subtitles
A class that deals with subtitle files from the Internet, you can provide a download link of subtitle in the constructor function for the purpose of completing its processing. You can call it by NetworkSubtitle class or by factory constructor in SubtitleProvider.fromNetwork.
// Using [NetworkSubtitle] class.
NetworkSubtitle netSub = new NetworkSubtitle(Uri.parse('<YOUR SUBTITLE PATH URL>'));
// Using factory constructor.
SubtitleProvider netSub = SubtitleProvider.fromNetwork(Uri.parse('<YOUR SUBTITLE PATH URL>'));
It will throw an ErrorInternetFetchingSubtitle if failed to fetch subtitle or the successHttpStatus not matched.
- Inheritance
-
- Object
- SubtitleProvider
- NetworkSubtitle
Constructors
-
NetworkSubtitle(Uri url, {SubtitleType? type, Map<
String, String> ? headers, Duration? connectionTimeout, int successHttpStatus = HttpStatus.ok, bool badCertificateCallback(X509Certificate cert, String host, int port)?}) -
const
Properties
- badCertificateCallback → (bool Function(X509Certificate cert, String host, int port)?)
-
final
- connectionTimeout → Duration?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- successHttpStatus → int
-
final
- type → SubtitleType?
-
final
- url → Uri
-
The url of subtitle file on the internet.
final
Methods
-
getSubtitle(
) → Future< SubtitleObject> -
Abstract method return an instance of
SubtitleObject
.override -
getSubtitleType(
String ext) → SubtitleType -
Return the current SubtitleType depended on file extension.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited