get method

Future<GetOutput> get({
  1. required String tableName,
  2. required Map<String, dynamic> key,
  3. List<String>? attributesToGet,
  4. bool? consistentRead,
  5. Map<String, String>? expressionAttributeNames,
  6. String? projectionExpression,
  7. ReturnConsumedCapacity? returnConsumedCapacity,
})

Returns a set of attributes for the item with the given primary key by delegating to DynamoDB.getItem().

Implementation

Future<GetOutput> get({
  required String tableName,
  required Map<String, dynamic> key,
  List<String>? attributesToGet,
  bool? consistentRead,
  Map<String, String>? expressionAttributeNames,
  String? projectionExpression,
  ReturnConsumedCapacity? returnConsumedCapacity,
}) async {
  final getItemOutput = await dynamoDB.getItem(
      key: key.fromJsonToAttributeValue(),
      tableName: tableName,
      attributesToGet: attributesToGet,
      consistentRead: consistentRead,
      expressionAttributeNames: expressionAttributeNames,
      projectionExpression: projectionExpression,
      returnConsumedCapacity: returnConsumedCapacity);
  return GetOutput(
    getItemOutput.consumedCapacity,
    getItemOutput.item.toJson() ?? {},
  );
}