selectFriends method

Future selectFriends({
  1. required PickerFriendRequestParams params,
  2. BuildContext? context,
})

KO: 멀티 피커 요청
EN: Requests a multi-picker

Implementation

Future selectFriends({
  required PickerFriendRequestParams params,
  BuildContext? context,
}) async {
  if (await TokenManagerProvider.instance.manager.getToken() == null) {
    throw KakaoClientException(
      ClientErrorCause.tokenNotFound,
      'You must log in before using FriendPicker.',
    );
  }

  var exception = _isParameterCorrect(params);

  if (exception != null) {
    throw exception;
  }

  if (kIsWeb) {
    try {
      return await _invokeWebPicker(params, 'multiple');
    } catch (e) {
      rethrow;
    }
  }

  if (context == null) {
    throw KakaoClientException(
      ClientErrorCause.badParameter,
      'FriendPicker requires context.',
    );
  }

  if (!context.mounted) {
    throw KakaoClientException(
      ClientErrorCause.illegalState,
      "Context is not mouned",
    );
  }

  return await _navigateToWebView(context: context, params: params);
}