attachDriver method
Attaches a community driver and binds its sink to VrInputDriver.source.
Implementation
void attachDriver(VrInputDriver driver) {
_ensureAlive();
for (final registration in _drivers) {
if (identical(registration.driver, driver)) {
throw StateError('VrInputDriver is already attached.');
}
}
final registration = _DriverRegistration(
driver,
_BoundInputSink(
this,
driver.source,
driver is VrInputPrioritizedDriver
? (driver as VrInputPrioritizedDriver).priority
: priorityOf(driver.source),
),
);
_drivers.add(registration);
try {
driver.attach(registration.sink);
} catch (_) {
registration.sink._attached = false;
_drivers.removeLast();
rethrow;
}
}