removeLastComponent method

Uri removeLastComponent()

Implementation

Uri removeLastComponent() {
  String? lastPathComponent =
      path.split("/").lastOrNullWhere((it) => it.isNotEmpty);
  if (lastPathComponent == null) {
    return this;
  }
  return Uri.parse(
      toString().removeSuffix("/").removeSuffix(lastPathComponent));
}