Permanent Data I/O in Flutter: Adding “Starred” Comics

Up until now we have only used the temporary cache directory, but if we want to add a feature that allows the user to save some comics to local storage permanently as a way to keep their favorite comics always available to them. To do that, we need to have access to a permanent local storage facility.

That is available to us in the form of application documents directory, which is where an app is supposed to save data that should be kept until the user consciously deletes it.

We can get the path of the application documents directory using getApplicationDocumentsDirectory, and we can use it in the same way we use the cache directory we got through getTemporaryDirectory: we use getApplicationDocumentsDirectory().path ...

Get Programming Flutter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.