2

I am making a dropdown button in flutter. Its content depends on how many files there is in a folder. For example, I have the following assets folder assets/logos/. This folder has 4 files. Another folder could be assets/monsters/. This folder has 3 files. The first folder would result in a dropdown with the values 1,2,3, and 4. I have made the following method:

Directory monsterDirectory = new Directory(await rootBundle.loadString(path));
   List skins = monsterDirectory.listSync();
   skins.forEach((skin) {
     skinNumber++;
     amountOfSkins.add(skinNumber.toString());
     skinNumber++;
});

Where path is the assets path 'assets/collectibles/monsters/astro/'. This gives the following error:

Directory listing failed, path = 'assets/collectibles/monsters/astro/' (OS Error: No such file or directory, errno = 2)

What am I doing wrong?

  • its because `assets/collectibles/monsters/astro/` folder is a "pseudo" folder - it does not exist in a physical file system – pskink Feb 28 '20 at 18:31

0 Answers0