startsWith static method

bool startsWith(
  1. String haystack,
  2. dynamic needles
)

Determines if haystack starts with any of the needles.

Implementation

static bool startsWith(String haystack, dynamic needles) {
  final list = needles is List ? needles : [needles];
  for (final n in list) {
    final s = n.toString();
    if (s.isNotEmpty && haystack.startsWith(s)) return true;
  }
  return false;
}