deserializeIcon function
Implementation
IconPickerIcon? deserializeIcon(Map<String, dynamic> iconMap) {
final pack = iconMap['pack'];
final iconKey = iconMap['key'];
try {
switch (pack) {
case "material":
return DefaultMaterial.defaultIcons[iconKey];
case "allMaterial":
return AllMaterial.allIcons[iconKey];
case "sharpMaterial":
return SharpMaterial.sharpIcons[iconKey];
case "roundedMaterial":
return RoundedMaterial.roundedIcons[iconKey];
case "outlinedMaterial":
return OutlinedMaterial.outlinedIcons[iconKey];
case "cupertino":
return Cupertino.cupertinoIcons[iconKey];
case "fontAwesomeIcons":
return FontAwesome.fontAwesomeIcons[iconKey];
case "lineAwesomeIcons":
return LineAwesome.lineAwesomeIcons[iconKey];
case "custom":
final iconData = iconMap['iconData'];
return IconPickerIcon(
name: iconKey,
data: IconData(
iconData['codePoint'],
fontFamily: iconData['fontFamily'],
fontPackage: iconData['fontPackage'],
matchTextDirection: iconData['matchTextDirection'],
),
pack: IconPack.custom,
);
default:
return null;
}
} catch (e) {
return null;
}
}