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