getValue method

Object getValue(
  1. String key,
  2. {Object converterParameter}
)

Returns the value for a binding.

This uses the key that was set up with the binding. Additionally a converterParameter can be passed that will be send to a value converter if supplied with the binding.

Implementation

Object getValue(String key, {Object converterParameter}) {
  Object returnValue;
  Binding binding = _getBinding(key);
  if (binding.bindingDirection == BindingDirection.OneTime &&
      !binding.originalValue is _OriginalValueNeverSet) {
    returnValue = binding.originalValue;
  } else if (binding.valueConverter == null) {
    returnValue = binding.source.getValue(binding.sourceProperty);
  } else {
    returnValue = binding.valueConverter.convert(
        binding.source, binding.source.getValue(binding.sourceProperty),
        parameter: converterParameter);
  }

  if (binding.originalValue is _OriginalValueNeverSet &&
      binding.bindingDirection == BindingDirection.OneTime) {
    binding.originalValue = returnValue;
  }
  return returnValue;
}