![]() |
VOOZH | about |
SQLite is an open-source computer database used to store pieces of information and perform various operations, such as adding, deleting, and updating. SQLite doesn't need a server or backend code; all the data is saved to a computer file within the device, or we can say it is stored locally.
Create a new Flutter application using the command Prompt. To create a new app, write the following command and run it.
flutter create app_nameTo know more about it refer this article: Creating a Simple Application in Flutter.
To add the dependency to the pubspec.yaml file, add path and sqflite in the dependencies part of the pubspec.yaml file, as shown below:
Now, run the command below in the terminal.
flutter pub getOr
Run the command below in the terminal.
flutter pub add path sqfliteFollow the file structure below for better understanding.
Define the model class for the data that needs to be stored. This model class has data members like id, name, age, distancefromsun, and a constructor that initializes the data members.
planet.dart:
The Database class contains all the following functions,
database.dart:
main.dart: