AlarmModel constructor

AlarmModel(
  1. WidgetModel parent,
  2. String? id, {
  3. dynamic type,
  4. dynamic text,
  5. dynamic alarm,
})

Implementation

AlarmModel(WidgetModel parent, String? id,
    {dynamic type, dynamic text, dynamic alarm})
    : super(parent, id) {
  // set type
  this.type = AlarmType.generic;
  if (type is String) {
    this.type = toEnum(type.trim().toLowerCase(), AlarmType.values) ??
        AlarmType.generic;
  }
  if (type is AlarmType) this.type = type;

  if (text != null) this.text = text;
  if (alarm != null) alarming = alarm;

  // Build a binding to the parent value
  var binding = "{${parent.id}.value}";
  _value ??= StringObservable(Binding.toKey(this.id, 'value'), binding,
      scope: scope);
}