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 binaryIds = [
BinaryID(fileId: '<YOUR-FILE-ID>', organizationId: '<YOUR-ORG-ID>', locationId: '<YOUR-LOCATION-ID>'),
BinaryID(fileId: '<YOUR-FILE-ID>', organizationId: '<YOUR-ORG-ID>', locationId: '<YOUR-LOCATION-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(
binaryIds,
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<BinaryID> binaryIds, String datasetId) async {
final request = AddBinaryDataToDatasetByIDsRequest()
..binaryIds.addAll(binaryIds)
..datasetId = datasetId;
await _dataClient.addBinaryDataToDatasetByIDs(request);
}