analyzeColor function

List<String> analyzeColor(
  1. List<CupertinoDynamicColor> nextColors
)

It takes a list of colors and returns a list of strings

Args: nextColors (List): The list of colors that the user has selected.

Returns: A list of strings.

Implementation

List<String> analyzeColor(List<CupertinoDynamicColor> nextColors) {
  final List<String> colors = <String>[];
  for (final CupertinoDynamicColor currentColor in nextColors) {
    if (currentColor == CupertinoColors.systemBlue) {
      colors.add("blue");
    } else if (currentColor == CupertinoColors.systemRed) {
      colors.add("red");
    } else if (currentColor == CupertinoColors.systemGreen) {
      colors.add("green");
    } else if (currentColor == CupertinoColors.systemYellow) {
      colors.add("yellow");
    }
  }

  return colors;
}