We now need to allow our users to insert new data and edit or delete existing records in the database.
The first step is creating the asynchronous method that will add a new record to the places table. This will take an instance of Place, and call the insert() database helper method to add the new place. Add the following code in the DbHelper class in the dbhelper.dart file:
Future<int> insertPlace(Place place) async { int id = await this.db.insert( 'places', place.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); return id; }
Both the insert and edit functions require some user interface (UI) that can contain the text that the user types. We'll use another dialog box for the add and edit features, ...