isStartsWithConditional method

  1. @useResult
bool isStartsWithConditional(
  1. String? find, {
  2. required bool isPositiveSearch,
})

Conditional startsWith check.

Returns true if isPositiveSearch is true and the string starts with find, or if isPositiveSearch is false and the string does NOT start with find.

Implementation

@useResult
bool isStartsWithConditional(String? find, {required bool isPositiveSearch}) {
  if (isEmpty || find == null || find.isEmpty) {
    return false;
  }

  return isPositiveSearch ? startsWith(find) : isNotStartsWith(find);
}