Skip to main content

Modify data: update()

Performs an UPDATE on the table.

final res = await supabase
.from('cities')
.update({ 'name': 'Middle Earth' })
.match({ 'name': 'Auckland' })
.execute();

Notes

  • update() should always be combined with Filters to target the item(s) you wish to update.

Examples

Updating your data

final res = await supabase
.from('cities')
.update({ 'name': 'Middle Earth' })
.match({ 'name': 'Auckland' })
.execute();

Updating JSON data

Postgres offers a number of operators for working with JSON data. Right now it is only possible to update an entire JSON document, but we are working on ideas for updating individual keys.

final res = await supabase
.from('users')
.update({
'address': {
'street': 'Melrose Place',
'postcode': 90210
}
})
.eq('address->postcode', 90210)
.execute();