setBindingProperty method

  1. @override
void setBindingProperty(
  1. String key,
  2. dynamic value
)
override

Implementation

@override
void setBindingProperty(String key, value) {
  switch (key) {
    case 'fillStyle':
      Color? color = CSSColor.parseColor(castToType<String>(value));
      if (color != null) fillStyle = color;
      break;
    case 'direction': direction = parseDirection(castToType<String>(value)); break;
    case 'font': font = castToType<String>(value); break;
    case 'strokeStyle':
      Color? color = CSSColor.parseColor(castToType<String>(value));
      if (color != null) strokeStyle = color;
      break;
    case 'lineCap': lineCap = parseLineCap(castToType<String>(value)); break;
    // @TODO: Binding should guarantee that input value is determined type, like double or int.
    case 'lineDashOffset': lineDashOffset = castToType<num>(value).toDouble(); break;
    case 'lineJoin': lineJoin = parseLineJoin(castToType<String>(value)); break;
    case 'lineWidth': lineWidth = castToType<num>(value).toDouble(); break;
    case 'miterLimit': miterLimit = castToType<num>(value).toDouble(); break;
    case 'textAlign': textAlign = parseTextAlign(castToType<String>(value)); break;
    case 'textBaseline': textBaseline = parseTextBaseline(castToType<String>(value)); break;
    default: super.setBindingProperty(key, value);
  }
}