findById method

  1. @override
Future<Map<String, Object?>?> findById(
  1. String table,
  2. Object id
)
override

Busca por id.

Implementation

@override
Future<Map<String, Object?>?> findById(String table, Object id) async {
  final r = await _client.get(
    Uri.parse('$_base/$table?id=eq.$id&limit=1'),
    headers: _headers,
  );
  final rows = jsonDecode(r.body) as List;
  return rows.isEmpty ? null : (rows.first as Map).cast<String, Object?>();
}