ScannerOption constructor
ScannerOption({
- required String name,
- required String title,
- required String description,
- required OptionType type,
- required OptionUnit unit,
- Object? value,
- OptionConstraint? constraint,
- required bool isDetectable,
- required Configurability configurability,
- required bool isAutoSettable,
- required bool isEmulated,
- required bool isActive,
- required bool isAdvanced,
- required bool isInternal,
Implementation
ScannerOption({
/// The option name using lowercase ASCII letters, numbers, and dashes.
/// Diacritics are not allowed.
required String name,
/// A printable one-line title.
required String title,
/// A longer description of the option.
required String description,
/// The data type contained in the `value` property, which
/// is needed for setting this option.
required OptionType type,
/// The unit of measurement for this option.
required OptionUnit unit,
/// The current value of the option, if relevant. Note that the data
/// type of this property must match the data type specified in
/// `type`.
Object? value,
/// Defines [OptionConstraint] on the current scanner option.
OptionConstraint? constraint,
/// Indicates that this option can be detected from software.
required bool isDetectable,
/// Indicates whether and how the option can be changed.
required Configurability configurability,
/// Can be automatically set by the scanner driver.
required bool isAutoSettable,
/// Emulated by the scanner driver if true.
required bool isEmulated,
/// Indicates the option is active and can be set or retrieved. If false,
/// the `value` property will not be set.
required bool isActive,
/// Indicates that the UI should not display this option by default.
required bool isAdvanced,
/// Indicates that the option is used for internal configuration and
/// should never be displayed in the UI.
required bool isInternal,
}) : _wrapped = $js.ScannerOption(
name: name,
title: title,
description: description,
type: type.toJS,
unit: unit.toJS,
value: switch (value) {
bool() => value.toJS,
double() => value.toJS,
List<double>() => value.toJSArray((e) => e.toJS),
int() => value.toJS,
List<int>() => value.toJSArray((e) => e.toJS),
String() => value.toJS,
null => null,
_ => throw UnsupportedError(
'Received type: ${value.runtimeType}. Supported types are: bool, double, List<double>, int, List<int>, String')
},
constraint: constraint?.toJS,
isDetectable: isDetectable,
configurability: configurability.toJS,
isAutoSettable: isAutoSettable,
isEmulated: isEmulated,
isActive: isActive,
isAdvanced: isAdvanced,
isInternal: isInternal,
);