Storing data into a device is a key skill in Flutter development. In this chapter, we have created a data-driven app, leveraging the SQLite database.
In order to add the SQLite features in Flutter, we used the sqflite library, which contains asynchronous helper methods for SELECT, INSERT, UPDATE, and DELETE queries.
We used the openDb method, which returns a database object. The first time we called this method, the database was created with the specified name and version, and the following times, it was only opened.
We called the execute method to use the SQL language to insert records, and the rawQuery method to use a SELECT statement against the database.
We've created model classes that mirrored the structure of the tables in a database to make the code more reliable, easier to read, and to prevent data inconsistencies.
We used the insert, update, and delete...