> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> CometChat Calling SDK v5 - Setup for Flutter

<Info>
  **Faster Integration with UI Kits**

  If you're using CometChat UI Kits, voice and video calling can be quickly integrated:

  * Incoming & outgoing call screens
  * Call buttons with one-tap calling
  * Call logs with history

  👉 [Flutter UI Kit Calling Integration](/ui-kit/flutter/calling-integration)

  Use this Calls SDK directly only if you need custom call UI or advanced control.
</Info>

This guide walks you through installing the CometChat Calls SDK and initializing it in your Flutter application.

## Add the CometChat Dependency

### Step 1: Add Hosted Source

Add the CometChat Cloudsmith hosted source to your `pubspec.yaml` file:

```yaml theme={null}
dependencies:
  cometchat_calls_sdk:
    hosted: https://dart.cloudsmith.io/cometchat/cometchat/
    version: ^5.0.2
```

### Step 2: Install Dependencies

Run the following command to install the package:

```bash theme={null}
flutter pub get
```

## Add Permissions

### Android

Add the required permissions to your `android/app/src/main/AndroidManifest.xml`:

```xml theme={null}
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

<Note>
  For Android 6.0 (API level 23) and above, you must request camera and microphone permissions at runtime before starting a call.
</Note>

### iOS

Add the following usage descriptions to your `ios/Runner/Info.plist`:

```xml theme={null}
<key>NSCameraUsageDescription</key>
<string>This app requires camera access for video calls.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires microphone access for voice and video calls.</string>
```

<Note>
  iOS requires usage description strings for camera and microphone access. Without these entries, the app will crash when attempting to access the camera or microphone.
</Note>

## Initialize CometChat Calls

The `init()` method initializes the SDK with your app credentials. Call this method once when your application starts, typically in your `main()` function or root widget's `initState()`.

### CallAppSettingBuilder

The `CallAppSettingBuilder` class configures the SDK initialization:

| Parameter | Type   | Required | Description                    |
| --------- | ------ | -------- | ------------------------------ |
| `appId`   | String | Yes      | Your CometChat App ID          |
| `region`  | String | Yes      | Your app region (`us` or `eu`) |

```dart theme={null}
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';

String appId = "APP_ID"; // Replace with your App ID
String region = "REGION"; // Replace with your Region ("us" or "eu")

CallAppSettings callAppSettings = (CallAppSettingBuilder()
  ..appId = appId
  ..region = region
).build();

CometChatCalls.init(
  callAppSettings,
  onSuccess: (String message) {
    debugPrint("CometChat Calls SDK initialized successfully");
  },
  onError: (CometChatCallsException e) {
    debugPrint("CometChat Calls SDK initialization failed: ${e.message}");
  },
);
```

| Parameter         | Description                                   |
| ----------------- | --------------------------------------------- |
| `callAppSettings` | Configuration object with App ID and Region   |
| `onSuccess`       | Callback invoked when initialization succeeds |
| `onError`         | Callback invoked when initialization fails    |

## Check Initialization Status

You can verify if the SDK has been initialized using the `isInitialized` getter:

```dart theme={null}
if (CometChatCalls.isInitialized) {
  // SDK is ready to use
} else {
  // Initialize the SDK first
}
```
