flame icon indicating copy to clipboard operation
flame copied to clipboard

Feature Request: Modify Prefix and View Cache Keys

Open arthasyou opened this issue 1 year ago • 3 comments

Problem to solve

The current implementation of the Images class lacks flexibility in two areas:

  1. Changing the prefix value after instantiation.
  2. Viewing all the keys present in the image cache.

Proposal

I propose the addition of two features to the Images class:

  1. Change Prefix Value:

    • Implement a method like setPrefix(String newPrefix) that updates the _prefix variable and ensures all cached paths are updated accordingly.
  2. View Cache Keys:

    • Implement a method like List<String> getCacheKeys() that returns a list of all keys currently stored in the _assets map.

These enhancements would greatly improve the flexibility and usability of the Images class.

More information

These features would align with the asset management practices seen in other frameworks and libraries, making it easier for developers to manage assets dynamically and ensure better cache management.

Other

  • [x] Are you interested in working on a PR for this?

arthasyou avatar Jul 24 '24 09:07 arthasyou

Sound like good additions!

  1. I would use a setter here instead (and expose a getter)
  2. For this one I would just do List<String> get keys => _assets.keys;

You didn't check the box for working on a PR for this, so I guess we'll wait for someone else to pick this up (if you don't change your mind).

spydon avatar Jul 24 '24 09:07 spydon

ill do it ty

arthasyou avatar Jul 24 '24 13:07 arthasyou

I just had a look at images, and it already provides a setter for for the prefix, so it is only the getter for the keys that is needed.

spydon avatar Aug 06 '24 22:08 spydon

I just had a look at images, and it already provides a setter for for the prefix, so it is only the getter for the keys that is needed.

Is this issue still open? Looks like the only information is regarding the setter, but wasn't sure if this comment was meant to say that part of it has already been resolved. Would like to try and work this if there's anything left here 🙂

aalberti333 avatar Oct 04 '24 19:10 aalberti333

@aalberti333 I think it is all done! If you're here due to the hacktoberfest tag, our whole repo has the hacktoberfest tag on it so you can do any issue, even if it's not marked hacktoberfest (we've been pretty bad at tagging up issues this year, I'll try to look into that tomorrow). :)

spydon avatar Oct 04 '24 19:10 spydon