title: How to update a specific value in a database item?
body: <p>This is a todo list app and uses a database to use the CRUD functions. When the user does a specific action such as tap or swipe i want to mark the task as complete. I am a bit new to databases and am unsure on how to use update item to update the status of a task (completed or not completed). </p>
  
  <p>Could i get a suggestion on what is the correct way to update the <code>_isDone</code> value without deleting a task from the database</p>
  
  <p>Tried to search for other examples of to do list apps but they delete the completed task intead of marking it as completed</p>
  
  <p>database code - </p>
  
  <pre><code> //This is the database
  
    String _itemName;
    String _dateCreated;
    int _id;
    bool _isDone;
  
  
    TodoItem(this._itemName, this._dateCreated, [this._isDone]);
  
    TodoItem.map(dynamic obj) {
      this._itemName = obj["itemName"];
      this._dateCreated = obj["dateCreated"];
      this._id = obj["id"];
      this._isDone = obj["isDone"];
    }
  
  
    String get itemName =&gt; _itemName;
    String get dateCreated =&gt; _dateCreated;
    int get id =&gt; _id;
    bool get isDone =&gt; _isDone;
    Map&lt;String, dynamic&gt; toMap() {
      var map = new Map&lt;String, dynamic&gt;();
      map["itemName"] = _itemName;
      map["dateCreated"] = _dateCreated;
  
      if (_id != null) {
        map["id"] = _id;
      }
  
      return map;
    }
  
    TodoItem.fromMap(Map&lt;String, dynamic&gt; map) {
      this._itemName = map["itemName"];
      this._dateCreated = map["dateCreated"];
      this._id = map["id"];
      this._isDone = map["isDone"];
    }
  
  </code></pre>
  
  <p>update item function - </p>
  
  <pre><code>  Future&lt;int&gt; updateItem(TodoItem item) async {
      var dbClient = await db;
      return await dbClient.update("$tableName", item.toMap(),
          where: "$columnId = ?", whereArgs: [item.id]);
    }
  </code></pre>