In my project(flutter app) there is a file named color.dart inside the folder helper which is inside the lib folder. The content of the color.dart file is not getting imported in the other files(import code line of color.dart file is indicating yellow line as to indicate it is not used and the lines in the code which uses the content of the color.dart file [for example ‘primary’ a color that is defined in the color.dart file] are showing errors everywhere throughout the project). What could be the reason for this and how can I resolve this?
tried cleaning the build, rebooting the system many times, running ‘pub get’/’pub upgrade’ and clearing temp folder[enter
(https://i.stack.imgur.com/xJKVl.png)
enter image description here
2
Answers
The default color property in the material or Cupertino plugin name as color.dart and you make your own color.dart file and now flutter is getting confused about where it takes colors property. You can simply change your class name something else like customColor or anything but color.dart and use static color in you customized color class
try editing your Colors.dart file like:
Or
try this:
then