https://grokonez.com/flutter/flutter-sqlite-example-listview-crud-operations-sqflite-plugin
Flutter SQLite example - CRUD Operations with ListView & sqflite plugin
In previous post, we knew how to make SQLite CRUD Operations using sqflite plugin. In this tutorial, we're gonna build a Flutter App that allows us to make CRUD interactions with SQLite in a ListView
.
Related Post:
- Flutter ListView example with ListView.builder
- Flutter Navigator example – Send/Return data to/from new Screen
- Flutter SQLite example – CRUD operations with sqflite plugin
Firebase:
- Flutter Firebase Database example – Firebase Database CRUD with ListView
- Flutter Firestore example – Firebase Firestore CRUD with ListView
Example Overview
Goal
Our Flutter App will retrieve list of Notes from SQLite Database and show it in ListView
widget. Then we can click on Add button to create new Note, click on a Note item to update that Note, or delete a Note with remove Button.
Project Structure
-
Note
class (note.dart) is a Data Model. -
DatabaseHelper
class (database_helper.dart) handles CRUD Operations with SQLite using sqflite plugin. -
ListViewNote
(listview_note.dart) is aStatefulWidget
withList<Note>
is state variable. It shows the list usingListView.builder
, sends/gets data to/fromNoteScreen
usingNavigator
. -
NoteScreen
(note_screen.dart) is the user interface for adding/updating Note. - We add sqflite dependency in pubspec.yaml.
For more detailsa about ListView
and Navigator
, please visit:
- Flutter ListView example with ListView.builder
-
Flutter Navigator example – Send/Return data to/from new Screen
Practice
More: https://grokonez.com/flutter/flutter-sqlite-example-listview-crud-operations-sqflite-plugin
Top comments (0)