getIconColor method

  1. @override
Future<Color?> getIconColor(
  1. {required AppModel appModel,
  2. required DictionaryHeading heading}
)
override

If non-null, sets a custom enabled color that this action should have for a certain condition in the application. By default, this is the foreground color.

Implementation

@override
Future<Color?> getIconColor({
  required AppModel appModel,
  required DictionaryHeading heading,
}) async {
  bool hasDuplicates = await appModel.checkForDuplicates(heading.term);
  if (hasDuplicates) {
    return Colors.red;
  } else {
    return null;
  }
}