createResult method Null safety
- int colorCount
Implementation
List<int> createResult(int colorCount) {
List<int> colors = <int>[];
for (int i = 0; i < colorCount; ++i) {
final cube = cubes[i];
int weight = volume(cube, weights);
if (weight > 0) {
int r = (volume(cube, momentsR) / weight).round();
int g = (volume(cube, momentsG) / weight).round();
int b = (volume(cube, momentsB) / weight).round();
int color = ColorUtils.argbFromRgb(r, g, b);
colors.add(color);
}
}
return colors;
}