otherSpacesForInviteMembersProvider top-level property
final
List of spaces other than current space and it’s parent space
Implementation
final otherSpacesForInviteMembersProvider = FutureProvider.autoDispose
.family<List<Space>, String>((ref, spaceId) async {
//GET LIST OF ALL SPACES
final allSpaces = ref.watch(spacesProvider);
//GET PARENT SPACE
final parentSpaces = ref.watch(parentIdsProvider(spaceId)).valueOrNull;
//GET LIST OF SPACES EXCLUDING PARENT SPACES && EXCLUDING CURRENT SPACE
final spacesExcludingParentSpacesAndCurrentSpace = allSpaces.where((space) {
final roomId = space.getRoomIdStr();
return !(parentSpaces!.any((p) => p == roomId)) && roomId != spaceId;
}).toList();
return spacesExcludingParentSpacesAndCurrentSpace;
});