How to add files to a flutter app without listing them in `flutter:assets` section in pubspec.yaml - Stack Overflow

admin2025-04-17  1

I have a small app in flutter which uses a sqlite database through sqflite. I am trying to implement a simple migration:

  • Add sql script to the application in design time.
  • When the application starts, implement onCreate to look for the script files and execute them.

I don't want to list each file in the flutter: assets section in pubspec.yaml because I foresee I will have dozens of small sql scripts and listing them will be annoying.

I don't want to use drift because it's too heavy for what I want to do.

Is there a way to add the files to my app and list and read them?

转载请注明原文地址:http://anycun.com/QandA/1744856871a88589.html