Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前我正在开发像 snapchat 和 tik-tok 这样的应用程序,我需要在播放和从缓存中播放它们之前预先缓冲视频或将它们存储在缓存中
使用 precache() 方法在渲染屏幕之前预加载视频。
@override void didChangeDependencies() { precacheImage(theImage.image, context); super.didChangeDependencies(); }
或者precacheImage(videoName, context);在构建方法中返回 Widget 之前使用。
precacheImage(videoName, context);