Skip to content

Add new optional cacheKeyResolver#1005

Open
austinried wants to merge 4 commits intoryanheise:minorfrom
austinried:features/cache-key-resolver
Open

Add new optional cacheKeyResolver#1005
austinried wants to merge 4 commits intoryanheise:minorfrom
austinried:features/cache-key-resolver

Conversation

@austinried
Copy link
Copy Markdown

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
Copy Markdown
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