getFriends method

Future<Either<FriendshipsErrors, List<Friendship>>> getFriends(
  1. String connectedUserId
)

Get friends

Implementation

Future<Either<FriendshipsErrors, List<Friendship>>> getFriends(
    String connectedUserId) async {
  return _completeFriendships(
          get(
            _routePrefix,
            (json) {
              return (json as List<dynamic>)
                  .map((e) => Friendship.fromJson(e as Map<String, dynamic>))
                  .toList();
            },
          ),
          connectedUserId)
      .mapRight((value) {
    cache.get<List<Friendship>>("friends").data = value;
    return value;
  });
}