Search code examples
flutterassets

How can I add all files in sub-directories of assets in pubspec.yamal at once?


I want to add a JavaScript library in assets folder containing almost 32k items and so many sub-directories and they are interlinked with each other, I want to take advantage of this in web-view, I know its a foolish step, but I have to do this. Flutter supports to add all files in a directory but it will not include files in sub-directories and its not possible for me to mention each sub-directory and its sub-directories one by one. How can I accomplish this?


Solution

  • By just listing the directory name instead of the file name

    flutter:
      uses-material-design: true
      assets:
        - assets/foo/
        - assets/bar/
    

    This works only for the files directly in the listed directory, not for files in directories below foo/ or bar/