Home > Blockchain >  flutter Rewind deleted index
flutter Rewind deleted index

Time:10-21

i am creating an app which require me to rewind the previous swipe after removing from list. Base on research i found out that i can use this plugin or this pligin but the i cant use it because it does not suite what i want.

for example

//i have list of contact

List<contact> cont = [090,000,98,090,767,]

so if i remove the index 0 and 1, so i will left with

List<contact> cont = [98,090,767,]

if i click a rewind button first time it should return the index 1 back to the list

List<contact> cont = [000,98,090,767,]

CodePudding user response:

Create a new list and each time you remove an element from the original list add that element to the new list. When you click rewind take the first item from the new list and add it as as the first elemet of the original list. Don't forget to remove the first element from new list when you rewind.

  • Related