The guide will show about builder listview in flutter dynamic. We will try to creating a simple application using Flutter that is integrated with the SQLite database. You can try this tutorial with following example step by step. Before that, You can read other article with database connection with flutter  in this section Flutter Login With Database SQLite.

First, we must create a project using Visual Studio Code software with name “recyclerview”. Here’s how to create a new project using Visual Studio Code:

  1. Select View > Command Palette.
  2. Type “flutter”, and select the Flutter: New Project.
  3. Enter a project name,example such as “recyclerview”, and press Enter.
  4. Create or select the parent directory for the new project folder with name “recyclerview”.
  5. Wait for project creation to complete and the main.dart file to appear, the project will created with name “recyclerview”.

flutter-new-project

After that, create the database file in the directory application that was created. (e.g [projectname]/data/[databasename].db.

we must prepare the file database using sqlite first. All we have to do is create a file with the .db extension first.

 

new-database-sqlite

Edit file pubspec.yaml in your directory should look something like:

Next step,We’re going to need to create entity class with name fruit.dart in directory [projectname]/lib/which helps us manage a fruit’s data.

And Create database helper class with database_helper.dart like that :

After we create database_helper.dart, create file for the query to get data Fruits. The file query.dart like below :

Later, we create main.dart

The application can be run to show output below :

listview-in-Flutter

For complete source code you can see in Here.

Thank you for reading this article about How To Create Listview in Flutter Dynamic, I hope this article is useful for you. Visit My Github about Flutter in Here.

How To Create Listview in Flutter Dynamic

Leave a Reply

Your email address will not be published. Required fields are marked *