markInitCalled method

Future<void> markInitCalled({
  1. bool directlyCallNativeInit = false,
})

Mark the initialization method as being called on the Dart side.

Implementation

Future<void> markInitCalled({bool directlyCallNativeInit = false}) async {
  FWLoggerUtil.log(
      "markInitCalled _completeRemainingInitialization directlyCallNativeInit: $directlyCallNativeInit");
  if (directlyCallNativeInit) {
    await _completeRemainingInitialization(
        directlyCallNativeInit: directlyCallNativeInit);
    await FWMethodChannelUtil.getFirewokSDKChannel().invokeMethod(
      FireworkSDKNativeMethodName.markInitCalled.name,
    );
  } else {
    final initSucceeded =
        await FWMethodChannelUtil.getFirewokSDKChannel().invokeMethod(
      FireworkSDKNativeMethodName.markInitCalled.name,
    );
    if (initSucceeded is bool && initSucceeded == true) {
      FWLoggerUtil.log(
          "markInitCalled _completeRemainingInitialization sdkInitSucceeded: ${FWGlobalState.getInstance().sdkInitSucceeded}");
      await _completeRemainingInitialization(
          directlyCallNativeInit: directlyCallNativeInit);
    }
  }
}