Creating an icon widget with all icon import

Viewed 31

Hello I am new to flutter and learning, My question is how can I create a widget for icon where I enter image description herecan call all the libraries and then then use the Icon in other .dart file, I have done the same thing in React Native and want to achieve the same functionality in flutter as well

enter image description here

1 Answers

As per the Widget you have built, I do no think you need to define the customIcon list.

In your CustomIcon widget, simply pass the IconData in the type.

Example

import "package:flutter_feather_icons/flutter_feather_icons.dart";
CustomIcon(type: FeatherIcons.github)

If you want to use your customIcon so that you do not have to import the packages again, you could do

CustomIcon(type: customIcon.FeatherIcons.github)
Related