appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH
187 stars 214 forks source link

unable to manually update the swiper index #176

Closed stuartrapop closed 10 months ago

stuartrapop commented 10 months ago

Hello,

The issue I am having may be more related to my understanding of state management than a real issue with the package.

Each time the user swipes on a name, I add it to either a liked name or a disliked name list.

I then filter out these names for the list (names) being used for the swiper widget.

When I update the data for the swiper, I would like to be reset the index to 0.

Thanks,

List<String> updatedLikedNames = []; List<String> updatedDislikedNames = []; userProvider.connectUser?.liked.forEach((e) => { updatedLikedNames.add(e.toJson()['id']), }); userProvider.connectUser?.disliked.forEach((e) => { updatedDislikedNames.add(e.toJson()['id']), }); names = nameProvider.names .where((e) => !updatedLikedNames.contains(e.id.toString())) .where((e) => !updatedDislikedNames.contains(e.id.toString())) .toList();

stuartrapop commented 10 months ago

I found the answer here

https://github.com/appinioGmbH/flutter_packages/issues/128