deviceInfo property

DeviceInfo deviceInfo

The currently selected device from the availableDevices.

Throws an exception if not initialized.

Implementation

DeviceInfo get deviceInfo {
  if (data.deviceIdentifier == CustomDeviceIdentifier.identifier) {
    return CustomDeviceInfo(data.customDevice!);
  }
  return state.maybeMap(
    initialized: (state) => state.devices.firstWhere(
      (x) =>
          x.identifier.toString() ==
          (data.deviceIdentifier ?? defaultDevice.identifier.toString()),
      orElse: () => state.devices.first,
    ),
    orElse: () => throw Exception('Not initialized'),
  );
}