[Solved] How do I multiply two lists in flutter

Question

Asked by Vincent A on January 06, 2022 (source).

How do I multiply two distinct lists in flutter. Like example below

List a = [2,3];

List b = [1,4];

List c = [3,5];

how do I obtain

List d = [6,60];

Answer

Question answered by Yunus K (source).

void main() {
  List a = [2, 3];

  List b = [1, 4];

  List c = [3, 5];

  List d = [];

  for (int i = 0; i < a.length; i++) {
    d.add(a[i] * b[i] * c[i]);
  }
  print(d);
}
DART FLUTTER LIST
SHARE: