createPath static method
Creates a path by concatenating the provided path and segments.
If segments is null or empty, the original path is returned.
Otherwise, the path is concatenated with each segment from segments
separated by a forward slash ('/').
Implementation
static String createPath(String path, [Iterable<String>? segments]) =>
switch (segments) {
null || Iterable(isEmpty: true) => path,
_ => path + segments.map((e) => "/$e").join()
};