selectFriend method

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

KO: 싱글 피커 요청
EN: Requests a single picker

Implementation

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

  if (params.minPickableCount != DefaultValues.minPickableCount) {
    params.minPickableCount = DefaultValues.minPickableCount;
  }

  if (kIsWeb) {
    try {
      return await _invokeWebPicker(params, 'single');
    } 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, isSingle: true);
}