markInitCalled method

Future<void> markInitCalled()

You only need to call this method when you call init method in native side instead of Dart side.

Implementation

Future<void> markInitCalled() async {
  final hasCalledSDKInitFromNative =
      await FWMethodChannelUtil.getFirewokSDKChannel().invokeMethod(
    FireworkSDKNativeMethodName.markInitCalled.name,
  );

  if (hasCalledSDKInitFromNative is bool &&
      hasCalledSDKInitFromNative == true) {
    final shoppingInitNativeMethodName = ShoppingNativeMethodName.init.name;
    await FWMethodChannelUtil.getShoppingChannel().invokeMethod(
      shoppingInitNativeMethodName,
    );

    final liveStreamInitNativeMethodName =
        LiveStreamNativeMethodName.init.name;
    await FWMethodChannelUtil.getLiveStreamMethodChannel()
        .invokeMethod(liveStreamInitNativeMethodName);
  }

  FWGlobalState.getInstance().completeSdkInitCalledFuture();
}