removeLastWord method

String? removeLastWord(
  1. String? value
)

Implementation

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