countOccurrence method

int countOccurrence(
  1. String string
)

Counts the number of occurrences of value.

Implementation

int countOccurrence(String string) =>
    isEmpty ? 0 : RegExp(string).allMatches(this).length;