deleteBinaryDataByIds method
Delete binary data based on data ID.
Returns the number of pieces of data that were deleted.
_viam = await Viam.withApiKey(
dotenv.env['API_KEY_ID'] ?? '',
dotenv.env['API_KEY'] ?? ''
);
final dataClient = _viam.dataClient;
try {
final binaryDataIds = [
'<YOUR-BINARY-DATA-ID>',
'<YOUR-BINARY-DATA-ID>'
];
// Call the function to delete binary data
await dataClient.deleteBinaryDataByIds(binaryDataIds);
print('Successfully deleted binary data');
} catch (e) {
print('Error deleting binary data: $e');
}
For more information, see Data Client API.
Implementation
Future<int> deleteBinaryDataByIds(List<String> binaryDataIds) async {
final request = DeleteBinaryDataByIDsRequest()..binaryDataIds.addAll(binaryDataIds);
final response = await _dataClient.deleteBinaryDataByIDs(request);
return response.deletedCount.toInt();
}