configure method
Future<void>
configure({
- required TRegistration registration,
- DeploymentService? deploymentService,
- DeviceDataCollectorFactory? dataCollectorFactory,
Configure this ClientManager by specifying a registration for
this client device.
Optionally, you can specify or override:
deploymentService- where to get study deploymentsdataCollectorFactory- the factory for creating data collectors
Throws an AssertionError if this client manager has already been configured.
Throws NotConfiguredException if after configuration either
deploymentService or dataCollectorFactory is not set.
Implementation
@mustCallSuper
Future<void> configure({
required TRegistration registration,
DeploymentService? deploymentService,
DeviceDataCollectorFactory? dataCollectorFactory,
}) async {
assert(
!isConfigured,
'The client manager has already been configured. '
'Reconfiguring clients is not supported.',
);
_registration = registration;
repository.deviceRegistration = registration;
// override if specified and not null
_deploymentService = deploymentService ?? _deploymentService;
_dataCollectorFactory = dataCollectorFactory ?? _dataCollectorFactory;
if (_deploymentService == null || _dataCollectorFactory == null) {
throw NotConfiguredException(
'Both deploymentService and dataCollectorFactory must be specified '
'either during construction of the ClientManager or during configure().',
);
}
proxy = StudyDeploymentProxy(this.deploymentService);
}