addBinaryDataToDatasetByIds method
Adds binary data to a dataset based on IDs.
_viam = await Viam.withApiKey(
dotenv.env['API_KEY_ID'] ?? '',
dotenv.env['API_KEY'] ?? ''
);
final dataClient = _viam.dataClient;
// Example binary IDs to add to the dataset
final binaryDataIds = [
'<YOUR-BINARY-DATA-ID>',
'<YOUR-BINARY-DATA-ID>'
];
// Dataset ID where the binary data will be added
const datasetId = '<YOUR-DATASET-ID>';
try {
// Add the binary data to the dataset
await dataClient.addBinaryDataToDatasetByIds(
binaryDataIds,
datasetId
);
print('Successfully added binary data to dataset');
} catch (e) {
print('Error adding binary data to dataset: $e');
}
For more information, see Data Client API.
Implementation
Future<void> addBinaryDataToDatasetByIds(List<String> binaryDataIds, String datasetId) async {
final request = AddBinaryDataToDatasetByIDsRequest()
..binaryDataIds.addAll(binaryDataIds)
..datasetId = datasetId;
await _dataClient.addBinaryDataToDatasetByIDs(request);
}