Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want to multiply between two arrays values in flutter

I have 2 Array called A and B, and I want to multiply 2 array values and create a new result array

  final a = <int>[2, 3, 4];
  final b = <int>[1, 2, 3];
          
  final result = <int>[2, 6, 12];

Please help me to achieve this thing in the flutter

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this

void main() {
      final a = <int>[2, 3, 4];
      final b = <int>[1, 2, 3];
    
      final result = <int>[];
    
      for (int i = 0; i < a.length; i++) {
        result.add(a[i] * b[i]);
      }
    
      print(result);
    }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading