# handleRosterFetch method

Future <void> handleRosterFetch(

1. RosterRequestResult result

)

Handles the result from a roster fetch.

## Implementation

    Future<void> handleRosterFetch(RosterRequestResult result) async {
      await _lock.synchronized(() async {
        final removed = List<String>.empty(growable: true);
        final modified = List<XmppRosterItem>.empty(growable: true);
        final added = List<XmppRosterItem>.empty(growable: true);

        await _loadRosterCache();

        _currentVersion = result.ver;
        for (final item in result.items) {
          final result = _handleRosterItem(item);

          if (result.removed != null) removed.add(result.removed!);
          if (result.modified != null) modified.add(result.modified!);
          if (result.added != null) added.add(result.added!);
        }

        await _commitRoster(
          _currentVersion,
          removed,
          modified,
          added,
        );
      });
    }