getDevice method
- @protected
- required Application app,
- required TestDeviceInfo deviceInfo,
- required TestControllerState testControllerState,
Helper function to get a Device from the cache based on the
deviceInfo
. A Device will exist in the cache in the event it was
previously connected and now attempting to reconnect.
Implementation
@protected
Device getDevice({
required Application app,
required TestDeviceInfo deviceInfo,
required TestControllerState testControllerState,
}) {
var result = app.devices[deviceInfo.id];
if (result == null) {
result = Device(
app: app,
appIdentifier: app.appIdentifier,
device: deviceInfo,
testControllerState: testControllerState,
);
app.devices[deviceInfo.id] = result;
}
result.testControllerState = testControllerState;
return result;
}