Repository navigation
Detect Flutter project icons from web/favicon.png #22642
bramley-jetcharge
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Flutter projects get a letter monogram instead of their own icon in the sidebar, even though most of them already have a favicon on disk.
flutter createwith web support (on by default) generatesweb/favicon.pngand aweb/index.htmlthat links to it.ProjectFaviconResolvernever finds it:FAVICON_CANDIDATESchecks the project root,public/,app/,src/andassets/, but notweb/.ICON_SOURCE_FILESdoesn't includeweb/index.html. Reading it wouldn't help anyway: a declaredhrefis looked up underpublic/or the project root, not next to the HTML file, sohref="favicon.png"still misses.I ran the resolver from current
mainagainst two real Flutter apps. Both haveweb/favicon.png, and both resolve tonull.Proposal
Add one entry to
FAVICON_CANDIDATES:Put it after the existing web entries and before the
.icnsentries, so projects that already resolve an icon are unaffected. It adds one filesystem probe, and the probes already run in parallel.Why not something broader
The obvious extension is to detect Flutter projects' native app icons (for flutter apps that don't target web):
ios/Runner/Assets.xcassets/AppIcon.appiconset/or Android'sandroid/app/src/main/res/mipmap-*/ic_launcher.png. Similar rules would also cover native (ie non-Flutter) apps without the leading folder:app/src/main/res/for Android, and<AppName>/Assets.xcassets/AppIcon.appiconset/for iOS, where the folder is named after the app instead ofRunner. That would mean picking among several files and sizes and guessing folder names that vary between projects (Android modules aren't always calledapp), which is the kind of broad scan #4637 was closed for.web/favicon.pngis a single fixed path that the Flutter template creates.Projects without web support still fall back to the monogram. They can set an icon with
iconPathint3.jsonor with the icon picker in project settings.Related
.icnssupport for macOS app projects in the same way: a few fixed paths, appended at the end of the list.All reactions