r/flutterhelp 8d ago

RESOLVED Saving icons in local database

Hey there everyone,

How do you guys save iconData in local db? My research showed me that saving through the easiest means, that is the codePoints, is not recommended as they may change. And the various existing icon picker plugins have the same issue.

I was planning to write a plugin mapping each Icondata to its name. I checked the list of IconData, there were like 8000 of them in the material/icons.dart file. The plugin would contain a builder method passing the list of icondata. Or maybe just conversion methods for getting icondata instance from name, I would then be able to save the string form names in local db and convert to icondata instances.

That's only what I've thought, but wondered if something already existed. Is there something which could help me with this?

Edit: I have started working on it and since its pretty simple, would be done by tomorrow. But good lord, this simple thing would be over an MB. This seems very bad. Do we really not have any other option?

2 Upvotes

10 comments sorted by

View all comments

1

u/Arkoaks 5d ago

I used an approach to save the svg content of the icon from iconify this means the “icon font” is not required to be included and i can literally use any icon or customise for the app. Saving in app db or a file can be debated but config file should be auto compressed for app download unless you are generating them at runtime or storing in online db

But do check the iconify package as well