getHeightValueForGivenKey method

V getHeightValueForGivenKey(
  1. K key
)

Return sum of value with subsuquent value key. This is important to draw a bar in a stack as the subsequent value is smaller than the previous one creating stack of bars

Implementation

V getHeightValueForGivenKey(K key) {
  final labelWithValueWithOutPreviousValue = Map<K, V>.from(labelWithValue);
  for (final mapEntry in labelWithValue.entries) {
    if (mapEntry.key == key) {
      break;
    }
    labelWithValueWithOutPreviousValue.remove(mapEntry.key);
  }
  return labelWithValueWithOutPreviousValue.entries
      .map((e) => e.value)
      .reduce((value, element) => _combine(value, element));
}