init static method

Future<void> init({
  1. String? nativeAppKey,
  2. String? javaScriptAppKey,
  3. String? customScheme,
  4. bool? loggingEnabled,
  5. ServerHosts? serviceHosts,
  6. PlatformSupport? platformSupport,
  7. CommonPlatform? platformProvider,
})

KO: Kakao SDK 초기화
앱별 커스텀 URL 스킴은 customScheme으로 등록
loggingEnabled로 Kakao SDK 내부 로그 기능 활성화 여부 설정

EN: Initializes Kakao SDK
Register custom URL scheme for each app as customScheme
Set Whether to enable the internal log of the Kakao SDK with loggingEnabled

Implementation

static Future<void> init({
  String? nativeAppKey,
  String? javaScriptAppKey,
  String? customScheme,
  bool? loggingEnabled,
  ServerHosts? serviceHosts,
  PlatformSupport? platformSupport,
  CommonPlatform? platformProvider, // for testability
}) async {
  if (nativeAppKey == null && javaScriptAppKey == null) {
    throw KakaoClientException(
      ClientErrorCause.badParameter,
      'A Native App Key or JavaScript App Key is required',
    );
  }

  _nativeKey = nativeAppKey ?? '';
  _jsKey = javaScriptAppKey ?? '';
  _customScheme = customScheme ?? 'kakao$appKey';
  logging = loggingEnabled ?? false;
  hosts = serviceHosts ?? ServerHosts();
  platform = platformSupport ?? DefaultPlatformSupport();

  platformInfo = await PlatformInfo.create(
    sdkVersion: sdkVersion,
    platform: platformProvider,
  );

  SdkLog.i(
    '[KakaoSdk.init] completed | loggingEnabled=$logging appKeyType=${kIsWeb ? 'javascript' : 'native'}',
  );
}