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