appendPath method

String appendPath(
  1. String path
)

追加路径

Implementation

String appendPath(String path) {
  if (path.isEmptyString) {
    return this ?? "";
  }
  List<String> paths = [];
  Uri uri = Uri.parse(this!);
  var segments = uri.pathSegments;
  if (segments.isNotEmptyList) {
    segments.forEach((element) {
      if (element.isNotEmptyString) {
        paths.add(element);
      }
    });
  }
  var lst = path.split('/');
  lst.forEach((element) {
    if (element.isNotEmptyString) {
      paths.add(element);
    }
  });
  return uri.replace(pathSegments: paths).toString();
}