What is the best way to store colors in the flutter application?
currently, it looks like this: (is that a good way?)
I would like to know the best way
Example of colors:
import 'package:flutter/material.dart';
const Color orange = Color(0xFFFF6C00);
const Color purple1 = Color(0xFF7B1FA2);
Example of icons:
import 'package:flutter/material.dart';
const IconData checkIcon = Icons.check;
const IconData maleIcon = Icons.male;
const IconData femaleIcon = Icons.female;
>Solution :
You can have a separate file named constants.dart to store all your constants.
You should also name each constant with a preface with the letter K, so it’s easier to find when using your IDE’s auto-suggestions – you just need to type in the letter K.
for example, in your constants.dart file:
import 'package:flutter/material.dart';
const IconData KcheckIcon = Icons.check;
const IconData KmaleIcon = Icons.male;
const IconData KfemaleIcon = Icons.female;