updateData function
- NoteModel noteModel
update existing note noteModel
Implementation
Future<bool> updateData(NoteModel noteModel) async {
String updateApi = "$NOTE_API" + noteModel.itemId;
try {
var response = await http.patch(updateApi,
headers: {"Authorization": "Bearer ${Utils.loginToken}"},
body: json.encode({
"fields": {
"title": {"stringValue": noteModel.title},
"description": {"stringValue": noteModel.description},
"colorValue": {"stringValue": noteModel.colorValue.toString()}
}
}));
if (response.statusCode == 200) {
return true;
}
} catch (err) {
throw err;
}
}