getById method

Future<Map<String, dynamic>?> getById(
  1. String collection,
  2. String id
)

Gets a document by ID

Implementation

Future<Map<String, dynamic>?> getById(
  String collection,
  String id,
) async {
  final response = await _client.get(
    Uri.parse('$baseUrl/collections/$collection/documents/$id'),
    headers: _headers,
  );

  if (response.statusCode == 404) {
    return null;
  }

  return _handleResponse(response);
}