Skip to content
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

Add new optional cacheKeyResolver #1005

Open
wants to merge 4 commits into
base: minor
Choose a base branch
from

Conversation

austinried
Copy link

This PR adds an optional parameter to AudioService.init() that allows specifying a cacheKeyResolver function which specifies how a cache key is resolved for a given MediaItem's art with the cache manager. If no method is specified, the current behavior is kept (the URL is used as the cache key).

This new method allow custom cache key implementations to better support situations where the URL may not be suitable as a cache key. It also brings parity with other packages like cached_network_image which also allows specifying a custom cache key, so if you're using the same cache manager across both libraries you can also use the same cache keys.

Fixes #1001.

Pre-launch Checklist

  • I read the [CONTRIBUTING.md] and followed the process outlined there for submitting PRs.
  • My change is not breaking and lands in minor branch OR my change is breaking and lands in major branch.
  • If I'm the first to contribute to the next version, I incremented the version number in pubspec.yaml according to the [pub versioning philosophy].
  • I updated CHANGELOG.md to add a description of the change (format: * DESCRIPTION OF YOUR CHANGE (@your-git-username)).
  • I updated/added relevant documentation (doc comments with ///).
  • I ran dart analyze.
  • I ran dart format.
  • I ran flutter test and all tests are passing.

@austinried
Copy link
Author

@ryanheise any thoughts on this API/implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add optional cache key for MediaItem art
1 participant