Inserting new places on the map

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, ...

Get Flutter Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.