Skip to main content

Initialize the SDK

Initialize the Chat SDK before you use any other features.

Get the app key

A valid App Key is required for initialization. Go to the console to find the App Key for each app you have created.

If you have multiple apps, select the correct app name. Each app provides separate App Key and App Secret pairs for the Production and Development environments. Make sure you select the correct environment.

tip
  • If you did not create the app, confirm that the Data Center shown on the page matches your expectations.
  • If your app has not been approved for production, only the development environment is available.

Initialize

Call NCEngine.initialize() with an InitParams object before you call any other SDK APIs.

tip

NCEngine is a static class. It has no instance, so call all APIs directly on NCEngine.

Method

Dart
static Future<void> initialize(InitParams params)

Parameters

ParameterTypeDescription
appKeyStringThe App Key obtained from the console. Required.
naviServerString?Custom navigation server address. Optional.
fileServerString?Custom file server address for media uploads/downloads. Optional.
statisticServerString?Custom statistics server address. Optional.
logServerString?Custom log server address. Optional.
areaCodeAreaCode?Data center region code. Optional.
kickReconnectDevicebool?Whether to kick a reconnecting device when another device is already online. Optional.
compressOptionsCompressOptions?Image compression configuration options. Optional.
logLevelLogLevel?SDK log verbosity level. Optional.
pushOptionsPushOptions?Push provider configuration. Optional.
enablePushbool?Whether to enable push notifications. Optional.

Return value

Return valueDescription
Future<void>Completes when the native engine has been created and global callbacks have been bound.

Code example

Dart
import 'package:ai_nexconn_chat_plugin/ai_nexconn_chat_plugin.dart';

await NCEngine.initialize(InitParams(
appKey: '<your-app-key>',
));