![]() This function is used to fetch all data from the database Static Future createTables(sql.Database database) async ) : super(key: createState() => _HomePageState() Import 'package:sqflite/sqflite.dart' as sql Full code in sql_helper.dart: import 'package:flutter/foundation.dart' Install the sqflite plugin (note that the name has an “f”): flutter pub add sqfliteĢ. In the lib folder, add a new file named sql_helper.dart. ![]() It will be automatically added by SQLiteġ. Below is the structure of the table: Column We are going to create an SQLite database called kindacode.db. AdvertisementsĪ demo is worth more than a thousand words: Database Structure There are an update button and a delete button associated with each “item”. The saved “items” are fetched from the SQLite database and displayed with a list view. These text fields are used to create a new “item” or update an existing “item”. That bottom sheet contains 2 text fields corresponding to “title” and “description”. The app has a floating button that can be used to show a bottom sheet. In the scope of this tutorial, “activity”, “item”, and “journal” are interchangeable. For simplicity’s sake, we will call each of these activities a “journal” or an “item”. The app we are going to make is an offline diary that lets users record the activities they did during the day. A computer with Flutter installed and a code editor (VS Code is great).If you don’t, please see the official docs first. ![]() In order to fully understand the example, you should have:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |