fetchSubtitleContent static method

Future<String> fetchSubtitleContent(
  1. String url
)

Fetch subtitle content from URL

Implementation

static Future<String> fetchSubtitleContent(String url) async {
  try {
    final response = await http.get(Uri.parse(url));
    if (response.statusCode == 200) {
      return response.body;
    } else {
      throw Exception('Failed to fetch subtitle: ${response.statusCode}');
    }
  } catch (e) {
    throw Exception('Error fetching subtitle: $e');
  }
}