Flutter Remove list item

后端 未结 3 1554
迷失自我
迷失自我 2021-02-05 02:03

I have a question in my flutter dart script, this my script:

List replytile = new List();

replytile.add(
    new ReplyTile(
          


        
相关标签:
3条回答
  • 2021-02-05 02:48

    In your case this works:

    replytile.removeWhere((item) => item.id == '001');
    

    For list with specific datatype such as int, remove also works.Eg:

    List id = [1,2,3];
    id.remove(1);
    
    0 讨论(0)
  • 2021-02-05 02:49

    This also works

    _listofTaskUI.removeAt(_quantity);
    
    0 讨论(0)
  • 2021-02-05 03:00

    removeWhere allows to do that:

    replytile.removeWhere((item) => item.id == '001')
    

    See also List Dartdoc

    0 讨论(0)
提交回复
热议问题