Flutter Database SQFlite Create Table and save data into table

Simple way to create database for your flutter app and test it online.

  1. First of all add libraries and create a class to perform all database queries.
  2. Create an instance of database object where you want to perform action.
  3. Call the defined functions from database to your widget file.

1.)Add Library



Initialize database instance in main.dart

4.) Customer.dart

5.) MyPage.dart

Image to refer the code.

Now, follow steps to check your database:

  1. Open window ‘Device File Explorer’ in android studio.
  2. Follow your path data/data/app_flutter/app.db (in your case it might be different)
  3. Right click on app.db file and save as on desktop.
  4. Open link in browser https://sqliteonline.com/
  5. Go to file>Open DB
  6. Here choose app.db and your database is visible here just like below image. You can fire any query and test your database possibilities.

If you have any query then you can write it in comments.
I am ready to help you :)

Android & Flutter Programmer.