'How do i open srt file on flutter?

I am trying to load subtitle to a video using the flutter video player package it works good for short files but it stopped as the file get bigger I trayed subtitle_wrapper package but it has many bugs

Future<ClosedCaptionFile> getSubtitle(String url) async {
  final data = NetworkAssetBundle(Uri(path: url));
  final newdata = await data.load(url);
  String fileContents = getStringFromBytes(newdata);
  return captionFile = SubRipCaptionFile(fileContents);
}

this is getStringFromBytes function

getStringFromBytes(ByteData data) { final buffer = data.buffer; 
var list = buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
return utf8.decode(list); } 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source