createPath method Null safety

String createPath(
  1. String path,
  2. [Iterable? segments]
)

Implementation

static String createPath(String path, [Iterable? segments]) {
  if (segments == null || segments.isEmpty) {
    return path;
  }
  final list = segments.map((e) => '/$e');
  return path + list.join();
}