Add comma separated value to class list

前端 未结 2 1662
时光取名叫无心
时光取名叫无心 2021-01-22 19:40

I need to add the value in the list which is comma separated.

Sample data:

English,Hindi,French

Below is the class of List:



        
2条回答
  •  暖寄归人
    2021-01-22 20:19

    One way you can do this is like this.

    List _selectedLanguages;
    _selectedLanguages = (responseBody['user_lang'].split(',') as List).map((text) => Language(name: text)).toList();
    

提交回复
热议问题