leftPart function

String? leftPart(
  1. String? strVal,
  2. String needle
)

Implementation

String? leftPart(String? strVal, String needle) {
  if (strVal == null) return null;
  var pos = strVal.indexOf(needle);
  return pos == -1 ? strVal : strVal.substring(0, pos);
}