# Flutter public developer API documentation
> [!IMPORTANT]
>The `setup` API must be called before the `startSession` API.
> All other APIs must be called after both the `setup` and `startSession` APIs, otherwise they will be ignored.
>The `setDebugMode` API is the exception to that rule and may be called anywhere in the code.
### PendoSDK APIs
[setup](#setup) ⇒ `void`
[startSession](#startsession) ⇒ `void`
[setVisitorData](#setvisitordata) ⇒ `void`
[setAccountData](#setaccountdata) ⇒ `void`
[endSession](#endsession) ⇒ `void`
[track](#track) ⇒ `void`
[pauseGuides](#pauseguides) ⇒ `void`
[resumeGuides](#resumeguides) ⇒ `void`
[dismissVisibleGuides](#dismissvisibleguides) ⇒ `void`
[getDeviceId](#getdeviceid) ⇒ `String`
[getVisitorId](#getvisitorid) ⇒ `String`
[getAccountId](#getaccountid) ⇒ `String`
[setDebugMode](#setdebugmode) ⇒ `void`
## PendoSDK APIs
### `setup`
```c#
static Future setup(String appKey, {Map? pendoOptions}) async
```
>Establishes a connection with Pendo’s server. Call this API in your application’s main file (lib/main.dart). The setup method can only be called once during the application lifecycle. Calling this API is required before tracking sessions or invoking session-related APIs.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| appKey | String | The App Key is listed in your Pendo Subscription Settings in App Details |
| pendoOptions | Map? | PendoOptions should be `null` unless instructed otherwise by Pendo Support |
Example:
```c#
await PendoSDK.setup('your.app.key', null);
```
### `startSession`
```c#
static Future startSession(String? visitorId, String? accountId, Map? visitorData, Map? accountData) async
```
>Starts a mobile session with the provided visitor and account information. If a session is already in progress, the current session will terminate and a new session will begin. The termination of the app will also terminate the session.
>To generate an anonymous visitor, pass 'nil' as the visitorId. Visitor data and Account data are optional.
> No action will be taken if the visitor and account IDs do not change when calling the startSession API during an ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| visitorId | String? | The session visitor ID. For an anonymous visitor set to `null` |
| accountId | String? | The session account ID |
| visitorData | Dictionary? | Additional visitor metadata |
| accountData | Dictionary? | Additional account metadata |
Example:
```c#
Map visitorData = {'age': 21, 'country': 'USA'};
Map accountData = {'Tier': 1, 'Size': 'Enterprise'};
await PendoSDK.startSession('John Doe', 'ACME', visitorData, accountData)
```
### `setVisitorData`
```c#
static Future setVisitorData(Map visitorData) async
```
>Updates the visitor metadata of the ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| visitorData | Map | The visitor metadata to be updated |
Example:
```c#
Map visitorData = {'age': 25, 'country': 'UK', 'birthday': '01-01-1990'};
await PendoSDK.setVisitorData(visitorData)
```
### `setAccountData`
```c#
static Future setAccountData(Map accountData) async
```
>Updates the account metadata of the ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| accountData | Map | The account metadata to be updated |
Example:
```c#
Map accountData = {'Tier': 2, 'size': 'Mid-Market', 'signing-date': '01-01-2020'};
await PendoSDK.setAccountData(accountData)
```
### `endSession`
```c#
static Future endSession() async
```
>Ends the active session and stops collecting analytics or showing guides to the user. A new session can be started by calling the startSession API.
>This API is commonly used when the user logs out of your application.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
```c#
await PendoSDK.endSession();
```
### `track`
```c#
static Future track(String event, Map? properties) async
```
>Sends a track event with the specified properties.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| event | String | The track event name |
| properties | Map? | Additional metadata to be sent as part of the track event |
Example:
```c#
await PendoSDK.track('App Opened', {'Theme': 'Dark Mode'});
```
### `pauseGuides`
```c#
static Future pauseGuides(bool dismissGuides) async
```
>Pauses any guides from appearing during an active session. If the `dismissGuides` value is set to `true`, then any visible guide will be dismissed. Calling this API affects the current session. Starting a new session reverts this logic, enabling guides to be presented.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| dismissGuides | bool | Determines whether the displayed guide, if one is visible, is dismissed when pausing the display of the further guides |
Example:
```c#
await PendoSDK.pauseGuides(false);
```
### `resumeGuides`
```c#
static Future resumeGuides() async
```
>Resumes displaying guides during the ongoing session. This API reverses the logic of the `pauseGuides` API.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
```c#
await PendoSDK.resumeGuides();
```
### `dismissVisibleGuides`
```c#
static Future dismissVisibleGuides() async
```
>Dismisses any visible guide.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
```c#
await PendoSDK.dismissVisibleGuides();
```
### `getDeviceId`
```c#
static Future getDeviceId() async
```
>Returns the device's unique Pendo-generated ID.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
```c#
await PendoSDK.getDeviceId();
```
### `getVisitorId`
```c#
static Future getVisitorId() async
```
>Returns the ID of the visitor in the active session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
```c#
await PendoSDk.getVisitorId();
```
### `getAccountId`
```c#
static Future getAccountId() async
```
>Returns the ID of the account in the active session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
```c#
await PendoSDK.getAccountId();
```
### `setDebugMode`
```c#
static Future setDebugMode(bool isDebugEnabled) async
```
>Enable/disable debug logs from Pendo SDK. To debug the Pendo SDK we recommend calling this API before calling the setup API.
>Debug logs are turned off by default. Releasing your production app with the debug logs enabled is not recommended and may have performance repercussions on your app.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
| Param | Type | Description |
| :---: | :---: | :--- |
| isDebugEnabled | bool | Set to `true` to enable debug logs, `false` to disable |
Example:
```c#
await PendoSDK.setDebugMode(true);
await PendoSDK.setup("your.app.key", null);
```