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({
/// Option name using lowercase a-z, numbers, and dashes.
required String name,
/// Printable one-line title.
required String title,
/// Longer description of the option.
required String description,
/// The type that `value` will contain and that is needed for
/// setting this option.
required OptionType type,
/// Unit of measurement for this option.
required OptionUnit unit,
/// Current value of the option if relevant. Note the type passed here must
/// match the type specified in `type`.
Object? value,
/// Constraint on possible values.
OptionConstraint? constraint,
/// Can be detected from software.
required bool isDetectable,
/// Whether/how the option can be changed.
required Configurability configurability,
/// Can be automatically set by the backend.
required bool isAutoSettable,
/// Emulated by the backend if true.
required bool isEmulated,
/// Option is active and can be set/retrieved. If false, the
/// `value` field will not be set.
required bool isActive,
/// UI should not display this option by default.
required bool isAdvanced,
/// 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.jsify()!,
double() => value.jsify()!,
List<double>() => value.toJSArray((e) => e),
int() => value.jsify()!,
List<int>() => value.toJSArray((e) => e),
String() => value.jsify()!,
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,
);