You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
So one of the main reasons for increased app size is assets. While developing, we constantly keep on adding some images or fonts that our client wants and when it changes, we forget to remove the unused assets.
This analyzer (not linter rule) would provide the list of all the assets that we have not used in the project.
Possible Solution
Fetch the list of assets available in pubspec.yaml or assets folder (if the developer has simply imported assets/).
Search for the relative path or file name in the entire project to find its usage.
If the developer has used asset generation packages, we can check for the unused asset variables.
What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[x] Other (please specify:)
Are you willing to submit a pull request to implement this rule? I don't have much idea about how to write the script but if guided, definitely!
The text was updated successfully, but these errors were encountered:
So, the problem we got stuck earlier is - if a path to asset is combined with variables and the user has several assets having the same name, but located in different sub-directories, then how to properly notify the user, which one of the assets is not used?
For example,
first asset assets/icons/settings.png
second asset assets/background/settings.png
and then in code
final path ='...'final pathToAsset ='$path/settings.png'
What if even the path variable is combined from other variables?
Okk yes this can be possible. So I think in this case, we will have to use the concept of macros (not exactly macros, but just an example) so if the analyzer finds that the path is containing a variable or a non-constant string, replace that variable with the value of variable.
Okk yes this can be possible. So I think in this case, we will have to use the concept of macros (not exactly macros, but just an example) so if the analyzer finds that the path is containing a variable or a non-constant string, replace that variable with the value of variable.
I understand this can be real challenging.
Maybe there is something wrong with your thinking? How to determine the value of variable or a non-constant string? And what value we should use? The value may be requested from the server.
I think the analyzer should determine which assets must be used. Then the others may not be used. But we have no way to confirm. Because the factors that affect the variables may be the data from server, or the user's operation.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Summary
So one of the main reasons for increased app size is assets. While developing, we constantly keep on adding some images or fonts that our client wants and when it changes, we forget to remove the unused assets.
This analyzer (not linter rule) would provide the list of all the assets that we have not used in the project.
Possible Solution
pubspec.yaml
or assets folder (if the developer has simply importedassets/
).What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[x] Other (please specify:)
Are you willing to submit a pull request to implement this rule? I don't have much idea about how to write the script but if guided, definitely!
The text was updated successfully, but these errors were encountered: