isValidBackgroundImageValue static method

bool isValidBackgroundImageValue(
  1. String value
)

Implementation

static bool isValidBackgroundImageValue(String value) {
  // According to CSS Backgrounds spec, 'none' is a valid <bg-image> keyword.
  if (value == 'none') return true;
  return (value.lastIndexOf(')') == value.length - 1) &&
      (value.startsWith('url(') ||
          value.startsWith('linear-gradient(') ||
          value.startsWith('repeating-linear-gradient(') ||
          value.startsWith('radial-gradient(') ||
          value.startsWith('repeating-radial-gradient(') ||
          value.startsWith('conic-gradient('));
}