String? removeLastWord(String? value) { var res = value!.split(" "); //split by space res.removeAt(res.length); //remove last element res.join(" "); return null; }