updateById method

  1. @override
Future<bool> updateById(
  1. String table,
  2. Object id,
  3. Map<String, Object?> values
)
override

Atualiza por id; retorna se afetou algo.

Implementation

@override
Future<bool> updateById(
  String table,
  Object id,
  Map<String, Object?> values,
) async {
  final r = await _client.patch(
    Uri.parse('$_base/$table?id=eq.$id'),
    headers: {..._headers, 'prefer': 'return=representation'},
    body: jsonEncode(values),
  );
  if (r.statusCode >= 400) return false;
  return (jsonDecode(r.body) as List).isNotEmpty;
}