getLockDetails static method

Future<Device> getLockDetails(
  1. Request request,
  2. String id
)

Implementation

static Future<Device> getLockDetails(Request request, String id) async {
  final device = await getDeviceDetails(request, id);
  // For now lockDeviceTrait is device with only lock trait so stripping out
  // all the other traits
  final lockDeviceTrait =
      device.traits.where((element) => element.name == 'lock').toList();
  final lockDevice = Device(
      device.id,
      device.displayName,
      device.description,
      device.manufacturerName,
      device.model,
      device.serialNumber,
      device.createdAt,
      device.updatedAt,
      lockDeviceTrait);
  return lockDevice;
}