如何删除飞镖中字符串中最后一个字符?

How to delete characters from last in a in string in dart?

我想从字符串中删除一个字符说 String A = "Something" 在这里,我想创建一个 returns "Somethin" 的函数。请帮助。

void removeLastString() {
  String str = "Something";
  String result = str.substring(0, str.length - 1);
  print(result);
}