static bool validHexColor(String value) { final bool = RegExp(r'^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$'); if (bool.hasMatch("value")) { return true; } else { return false; } }