In dart, how to access the last element of a list?
var lst = ["element1" , "element2" , "element3"];
My list is dynamic.
you can use last
property for read/write, inherited-getter:
last
is a returns the last element from the given list.
var lst = ["element1" , "element2" , "element3"];
lst.last // -> element3
or
lst[lst.length-1] //-> element3