getRecord method

Future<AirtableRecord?> getRecord(
  1. String recordName,
  2. String recordId
)

Gets a single record based on the record name and ID from Airtable

Returns nullable Future

Implementation

Future<AirtableRecord?> getRecord(String recordName, String recordId) async {
  final response = await client
      .get(_recordApiUrl(recordName, path: '/$recordId'), headers: _headers);

  if (response.statusCode == HttpStatus.notFound.code ||
      response.body.isEmpty) {
    return null;
  }

  Map<String, dynamic> body = jsonDecode(response.body);

  return AirtableRecord.fromJSON(body);
}