OptionSetting constructor

OptionSetting({
  1. required String name,
  2. required OptionType type,
  3. Object? value,
})

Implementation

OptionSetting({
  /// Indicates the name of the option to set.
  required String name,

  /// Indicates the data type of the option. The requested data type must
  /// match the real data type of the underlying option.
  required OptionType type,

  /// Indicates the value to set. Leave unset to request automatic setting for
  /// options that have `autoSettable` enabled. The data type
  /// supplied for `value` must match `type`.
  Object? value,
}) : _wrapped = $js.OptionSetting(
        name: name,
        type: type.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')
        },
      );