-
-
Notifications
You must be signed in to change notification settings - Fork 41
feat: allow replacing the default implementations of the cache manager and storage #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
OutdatedGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, few questions and changes.
|
I've made a couple of changes additionally:
|
|
@OutdatedGuy friendly ping |
OutdatedGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Will once check updated example app and then merge.
Thanks for the contribution!
Screen.Recording.2025-10-04.at.12.39.48.PM.mov@AlexV525 the example app doesn't seems to be working correctly |
I'll look into it next week |
|
Hi @AlexV525, do you plan on fixing the example app? :) |
|
The example fails because the file caches always read from the
This is a hard-coded behavior that implicitly uses the same storage as the default metadata storage. I'll update the storage to provide an interface method like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces extensibility to the cached video player by extracting storage into an interface and making the default cache manager and metadata storage implementations replaceable. This allows users to provide custom implementations instead of being locked into SharedPreferences or the default cache manager.
Key Changes:
- Extracted
IVideoPlayerMetadataStorageinterface from the default implementation, enabling custom storage implementations - Made static cache manager and metadata storage fields mutable (non-final) to allow runtime replacement
- Added optional constructor and static method parameters for custom cache manager and metadata storage instances
Reviewed Changes
Copilot reviewed 11 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/i_video_player_metadata_storage.dart | New interface defining the contract for video metadata storage implementations |
| lib/src/video_player_metadata_storage.dart | Renamed from VideoPlayerStorage and updated to implement the new interface |
| lib/src/cached_video_player_plus.dart | Added mutable static fields for cache manager and metadata storage, updated constructors and static methods to accept custom implementations |
| lib/cached_video_player_plus.dart | Exported new interface and implementation classes for public API |
| example/pubspec.yaml | Reorganized dependencies (moved flutter SDK to top, removed direct shared_preferences dependency) |
| example/lib/pages/advance_cache_management_page.dart | Demonstrated custom implementations with in-memory metadata storage and custom cache manager toggle functionality |
| example/lib/main.dart | Minor UI adjustment wrapping title text in FittedBox for better layout |
| example/pubspec.lock | Updated transitive dependency versions |
| example/macos/Runner.xcodeproj/project.pbxproj | Updated macOS deployment target to 10.15 and added CLANG configuration |
| example/ios/Runner.xcodeproj/project.pbxproj | Added CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES setting |
| example/macos/Podfile | Updated minimum macOS platform version to 10.15 |
| example/macos/Podfile.lock | Updated pod checksums reflecting dependency updates |
| example/ios/Podfile.lock | Updated Flutter framework checksum |
| example/macos/.gitignore | Added DerivedData to ignored files |
| .gitignore | Added devtools_options.yaml to ignored files |
Comments suppressed due to low confidence (1)
lib/src/video_player_metadata_storage.dart:12
- The comment references the old class name
VideoPlayerStoragebut the class has been renamed toVideoPlayerMetadataStorage. The comment should be updated to match the new class name.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
OutdatedGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lot's of unrelated files changed.
Few nitpicks and bugs in example app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
lib/src/video_player_metadata_storage.dart:12
- The comment still references the old class name
VideoPlayerStoragebut should be updated toVideoPlayerMetadataStorage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
OutdatedGuy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Thanks for the contribution @AlexV525 |
The storage interface has been extracted from the default implementation. Users can implement their own instead of using Get Storage or Shared Preferences.