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

remove specific item range from list

i have 2 dropdowns 1st is toDate and 2nd is fromDate with 1 list of months to be displayed.

List<String> month = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];

in the first dropdown, all the list is shown to select but in the 2nd dropdown, I want to show all values coming after the selected 1st dropdown value.

for example – :
in the first dropdown, I selected ‘March’ the 2nd dropdown the list displayed should be after ‘March’.

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

How do I do it?
please help.

>Solution :

void main() {
  List<String> month = [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December',
  ];
  var choice = 'March';
  var ind = month.indexOf(choice);
  if (ind > 0) {
    print(month.skip(ind + 1));
  }
}
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