make extention
membuat fungsi pada extention
3
Below is the code to update a single item of list using the index. You can simple create an extension function for the same.
And use it like below to replace an item.
Last updated
Was this helpful?
membuat fungsi pada extention
3
Below is the code to update a single item of list using the index. You can simple create an extension function for the same.
And use it like below to replace an item.
Last updated
Was this helpful?
Was this helpful?
extension ListUpdate<T> on List {
List update(int pos, T t) {
List<T> list = new List();
list.add(t);
replaceRange(pos, pos + 1, list);
return this;
}
}replytile.update(
5, new ReplyTile(
member_photo: "photo",
member_id: "001",
date: "01-01-2018",
member_name: "Denis",
id: "001",
text: "hallo.."
)
);