Search code examples
androidandroid-sqliteflutter

How to add new content to my flutter app on the fly?


My flutter app provides some content (mostly text and graphics, like blog posts, or news) to its users. These contents need to be updated daily. So there will be new texts, images, maybe even videos. Now, the app would be used even when offline, so all the updated contents should be stored somewhere to be accessed later.

  • Right now, I'm using a SQLite DB to store texts
  • The images are stored in the Assets folder of the app.
  • The nature of the program is such that the users won't want to give the app any SD-Card access permission.

So my question is, how can I update the content without updating the whole app or using any SDcard permissions?

Is it possible to write code that downloads the new content and saves them directly in the Assets folder of the app? Can the app then use the files? without them being referenced in "pubspec.YAML" file?

Can I store all the data (even images and videos which are added daily) in my SQLite DB which is located in phone memory?

What is the standard practice for apps that have this kind of content?


Solution

  • You have to use the storage somehow.

    In Android, you don't have to ask for storage permission if you want to save data in internal directory for your app which is storage/emulated/0/Android/data/data/your_package_name/ folder. You can try that.

    However it has got a downside, if your app is deleted then all the data will also be deleted.