setNameFromPath method Null safety

void setNameFromPath()

Sets the name from the original path

This can be useful when the mailbox name was localized for viewing purposes.

Implementation

void setNameFromPath() {
  final splitIndex = _encodedPath.lastIndexOf(pathSeparator);
  if (splitIndex == -1 || splitIndex == _encodedPath.length - 1) {
    name = _encodedPath;
  } else {
    name = _encodedPath.substring(splitIndex);
  }
}