quantize method Null safety

  1. @override
Future<QuantizerResult> quantize(
  1. Iterable<int> pixels,
  2. int colorCount
)
override

Implementation

@override
Future<QuantizerResult> quantize(Iterable<int> pixels, int colorCount) async {
  final result = await QuantizerMap().quantize(pixels, colorCount);
  constructHistogram(result.colorToCount);
  computeMoments();
  final createBoxesResult = createBoxes(colorCount);
  final results = createResult(createBoxesResult.resultCount);
  return QuantizerResult(Map.fromEntries(results.map((e) => MapEntry(e, 0))));
}