allocationAccordingTo method

List<Fixed> allocationAccordingTo(
  1. List<int> ratios
)

Spread the value across 'n' Fixed values according to the supplie ratios.

'n' is controlled by the number of ratios passed.

Implementation

List<Fixed> allocationAccordingTo(List<int> ratios) {
  if (ratios.isEmpty) {
    throw ArgumentError.value(ratios, 'ratios',
        'List of ratios must not be empty, cannot allocate to nothing.');
  }

  return _doAllocationAccordingTo(ratios.map((ratio) {
    if (ratio < 0) {
      throw ArgumentError.value(
          ratios, 'ratios', 'Ratio must not be negative.');
    }

    return BigInt.from(ratio);
  }).toList());
}