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
| Parameter | Type | Description |
|---|---|---|
appKey | String | The App Key obtained from the console. Required. |
naviServer | String? | Custom navigation server address. Optional. |
fileServer | String? | Custom file server address for media uploads/downloads. Optional. |
statisticServer | String? | Custom statistics server address. Optional. |
logServer | String? | Custom log server address. Optional. |
areaCode | AreaCode? | Data center region code. Optional. |
kickReconnectDevice | bool? | Whether to kick a reconnecting device when another device is already online. Optional. |
compressOptions | CompressOptions? | Image compression configuration options. Optional. |
logLevel | LogLevel? | SDK log verbosity level. Optional. |
pushOptions | PushOptions? | Push provider configuration. Optional. |
enablePush | bool? | Whether to enable push notifications. Optional. |
Return value
| Return value | Description |
|---|---|
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>',
));