Skip to content

Commit 477a474

Browse files
committed
added doc comments
1 parent f8a4d74 commit 477a474

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

templates/flutter/lib/src/realtime.dart.twig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,40 @@ import 'client.dart';
77

88
abstract class Realtime extends Service {
99
factory Realtime(Client client) => createRealtime(client);
10+
11+
/// Channels to subscribe - pass a list of channels to subscribe
12+
///
13+
/// Possible channels are:
14+
/// - account
15+
/// - collections
16+
/// - collections.[ID]
17+
/// - collections.[ID].documents
18+
/// - documents
19+
/// - documents.[ID]
20+
/// - files
21+
/// - files.[ID]
22+
/// - executions
23+
/// - executions.[ID]
24+
/// - functions.[ID]
25+
/// - teams
26+
/// - teams.[ID]
27+
/// - memberships
28+
/// - memberships.[ID]
29+
///
30+
/// Returns a `RealtimeSubscription` object, which can be used to listen to events on the channels
31+
/// and to close the subscription to stop listening.
32+
///
33+
/// The sample shows how you could use realtime to listen to changes in a collections.
34+
///
35+
/// ```dart
36+
/// final realtime = Realtime(client);
37+
/// final subscription = realtime.subscribe(['collections']);
38+
/// subscription.stream.listen((event) {
39+
/// print(event);
40+
/// });
41+
///
42+
/// subscription.close();
43+
/// ```
44+
///
1045
RealtimeSubscription subscribe(List<String> channels);
1146
}

0 commit comments

Comments
 (0)