Closed pranjal-joshi closed 4 years ago
Thank you @pranjal-joshi for using my package đź’™.
At first I have good news for you: You don't have to worry about Serialization :).
This package is handling and providing this for you.
Look deeper in the readme and you'll find this:
iconDataToMap​(iconData)
Use that method to convert you IconData object into savable json for your shared prefs.
After that, if you want to load it from shared prefs use:
mapToIconData(map)
best regards :)
Thank you @pranjal-joshi for using my package đź’™.
At first I have good news for you: You don't have to worry about Serialization :).
This package is handling and providing this for you.
Look deeper in the readme and you'll find this:
iconDataToMap​(iconData)
Use that method to convert you IconData object into savable json for your shared prefs.
After that, if you want to load it from shared prefs use:
mapToIconData(map)
best regards :)
Thanks for the quick help! I'll go through the docs and will let you know :)
@Ahmadre
I found that in my serialization method, I missed fontFamily
property of iconData which was resulting as null
while deserializing was the cause of this issue, After implementing a way to handle fontFamily
, Now the issue is resolved!
Hello, In my use case,
Note: Here the last item is added manually in the list, However, the first 3 items are fetched from
FlutterIconPicker
will help the user to pick an icon, then this icon info is saved in some class. This class will be serialized toJSON
and will be Stored/Retrieved fromSharedPreferences
as a configuration data. While loading from shared preference, I get theiconCode
correct, but after using it asIcon(IconData(iconCode))
, I get a strange output as shown in following image:SharedPreference
and no exception has been thrown during fetching and populating the data!