Skip to content

Commit 5184d27

Browse files
authored
Merge pull request #361 from dyte-io/flutter/cleanup-api
docs: cleanly remove listeners in flutter_core
2 parents 29ca8bd + f991227 commit 5184d27

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

docs/flutter-core/quickstart.mdx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ You'll learn how to:
6969

7070
After importing the package, perform the following steps for Android and iOS.
7171

72-
7372
### For iOS
7473

7574
1. Set your platform to iOS 13.0 or above in your Podfile.
@@ -130,12 +129,12 @@ final dyteClient = DyteMobileClient();
130129
Set the properties in the `DyteMeetingInfo` class. You just need to provide the
131130
participant's `authToken`.
132131

133-
| Name | Description |
134-
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
135-
| `authToken` | After you've created the meeting, <br/> add each participant to the meeting <br/> using the [Add Participant API](/api?v=v2#/operations/add_participant)<br/> (The presetName created earlier <br/> must be passed in the body <br/> of the Add Participant API request) <br/> The API response contains the `authToken`. |
136-
| `baseUrl` | The base URL of the Dyte server. Default value is `https://api.dyte.io/v2`. This is an optional argument. |
137-
| `enableAudio` | A boolean value to enable or disable audio in the meeting. Default value is `true`. This is an optional argument. |
138-
| `enableVideo` | A boolean value to enable or disable video in the meeting. Default value is `true`. This is an optional argument. |
132+
| Name | Description |
133+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134+
| `authToken` | After you've created the meeting, <br/> add each participant to the meeting <br/> using the [Add Participant API](/api?v=v2#/operations/add_participant)<br/> (The presetName created earlier <br/> must be passed in the body <br/> of the Add Participant API request) <br/> The API response contains the `authToken`. |
135+
| `baseUrl` | The base URL of the Dyte server. Default value is `https://api.dyte.io/v2`. This is an optional argument. |
136+
| `enableAudio` | A boolean value to enable or disable audio in the meeting. Default value is `true`. This is an optional argument. |
137+
| `enableVideo` | A boolean value to enable or disable video in the meeting. Default value is `true`. This is an optional argument. |
139138

140139
```dart
141140
final meetingInfo = DyteMeetingInfoV2(
@@ -238,13 +237,19 @@ Successful joining of meeting is indicated by `onMeetingRoomJoined` callback.
238237

239238
Once the meeting is over, you can leave the meeting room.
240239

240+
Once leave meeting is completed or you decide to `release()` the meeting [called when user exits the SDK without joining the meeting room, say user exited from setup/waiting room], make sure to cleanup all listeners by calling `dyteClient.cleanAllNativeListeners()`.
241+
241242
To leave the meeting room, call `leaveRoom()` method on the `dyteClient` as
242243
shown below.
243244

244245
```dart
245246
dyteClient.leaveRoom();
246247
```
247248

249+
### Cleanup listeners
250+
251+
Introduced in `dyte_core: 0.3.6`, `cleanAllNativeListeners()` method which needs to be called when you're done with current session of dyte meeting. It interally calls individual new clean methods for each listener `cleanNativeMeetingRoomEventsListener()`, `cleanNativeParticipantEventListener()`, `cleanNativePollListener()`, `cleanNativeRecordingListener()`, `cleanNativeStageEventsListener()`, `cleanNativeSelfParticipantEventListener()`, `cleanNativeChatListener()`, `cleanNativeDataUpdateListener()`, `cleanNativeLivestreamListener()`, `cleanNativePluginEventsListener()`.
252+
248253
By registering state observers, you receive callbacks for this action on the
249254
meeting object.
250255

@@ -260,6 +265,8 @@ class RoomStateNotifier implements DyteMeetingRoomEventsListener {
260265
261266
@override
262267
void onMeetingRoomLeaveCompleted() {
268+
dyteClient.removeMeetingRoomEventsListener(this);
269+
dyteClient.cleanupAppListeners();
263270
/// on meeting room left
264271
}
265272
@@ -292,5 +299,8 @@ end
292299

293300
<head>
294301
<title>Flutter Core Quickstart</title>
295-
<meta name="description" content="Dive into the core of Flutter development with Dyte. Explore essential documentation to streamline your Flutter app integration."/>
302+
<meta
303+
name="description"
304+
content="Dive into the core of Flutter development with Dyte. Explore essential documentation to streamline your Flutter app integration."
305+
/>
296306
</head>

0 commit comments

Comments
 (0)