launchBrowserTab function
플랫폼별 기본 브라우저로 URL 실행
URL을 팝업으로 열고싶을 때 popupOpen
사용. 웹에서만 사용 가능
Implementation
Future<String> launchBrowserTab(Uri uri,
{String? redirectUri, bool popupOpen = false}) async {
if (uri.scheme != CommonConstants.http &&
uri.scheme != CommonConstants.scheme) {
throw KakaoClientException(
ClientErrorCause.notSupported,
'Default browsers only supports URL of http or https scheme.',
);
}
var args = {
CommonConstants.url: uri.toString(),
CommonConstants.redirectUri: redirectUri,
CommonConstants.isPopup: popupOpen,
};
args.removeWhere((k, v) => v == null);
final redirectUriWithParams = await _methodChannel.invokeMethod<String>(
CommonConstants.launchBrowserTab, args);
if (redirectUriWithParams != null) return redirectUriWithParams;
throw KakaoClientException(
ClientErrorCause.unknown,
"OAuth 2.0 redirect uri was null, which should not happen.",
);
}