0

Sorry in advance since I am quite new to Flutter. I have a variable as shown below:

var points = <LatLng>[
    new LatLng(35.22, -101.83),
    new LatLng(32.77, -96.79),
    new LatLng(29.76, -95.36),
    new LatLng(29.42, -98.49),
    new LatLng(35.22, -101.83),
  ];

And I have a list of 10000 objects as shown below:

[
  [712587.3450605758, 1222487.8048128784], 
  [712605.1304073846, 1222422.3607431017], 
  [712633.6284776889, 1222314.3680556398], 
  [712671.8758878317, 1222172.6276533436], 
  [712682.3751768898, 1222133.630293984],
  // and more...
]

How would i incorporating this in the previous points variable so that i don't have to type it 10000 times????

1 Answer 1

1

Basically you can iterate with a simple forEach loop on your second list and add elements to your first:

secondList.forEach((element) => points.add(LatLng(element[0], element[1]));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.