flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

getSingleFile() doesn't return fully downloaded file

Open jasonkaruza opened this issue 6 years ago • 0 comments

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17763.678], locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.4)
[√] VS Code (version 1.37.0)
[√] Connected device (1 available)

For those that are attempting to use getSingleFile() before using video_player to play a downloaded video, even when doing an await on getSingleFile() the File is very often returned before the video is downloaded fully, which causes the video player to fail initialization.

No attempts at re-downloading or re-initilializing seemed to work, so dropped use of flutter_cache_manager and switched to downloading the file locally using dio package. This obviously negates the benefit of cache management, but it seemed to respect await properly by ensuring that the file returned is completely downloaded before returning.

jasonkaruza avatar Aug 15 '19 17:08 jasonkaruza