fromRemoteList static method

List<ConsentParticipant> fromRemoteList(
  1. List<RemoteParticipantConsent> remoteList
)

Implementation

static List<ConsentParticipant> fromRemoteList(
    List<RemoteParticipantConsent> remoteList) {
  final Map<String, RemoteParticipantConsent> uidToParticipant = {};

  for (var remote in remoteList) {
    final uid = remote.rtcParticipantUid;
    if (uid != null) {
      // Always keep the latest one — this will overwrite any earlier entry
      uidToParticipant[uid] = remote;
    }
  }

  return uidToParticipant.values
      .map((remote) => ConsentParticipant.fromRemote(remote))
      .toList(); // final list will have latest entries at the end
}