Convert String to ImagePath

How to convert String data type to ImagePath?

I wrote a function that generates images:

List<String> generujNazwyPlikow(
  String link,
  int iloscPlikow,
) {
  List<String> nazwyPlikow = [];
  for (int i = 1; i <= iloscPlikow; i++) {
    String numerPliku =
        i.toString().padLeft(2, '0');
    String nazwaPliku = link.replaceAll(
        '.jpg', '_$numerPliku.jpg');
    nazwyPlikow.add(nazwaPliku);
  }
  return nazwyPlikow;
}

And I cannot generate a list of ImagePath type because I receive information that such type does not exist:

List<ImagePath> generujNazwyPlikow(
  String link,
  int iloscPlikow,
) {}

So I need to convert the String type to ImagePath later, but I don't know how to do it.

2
4 replies