FirebasePresenceService class
Firebase RTDB-backed PresenceService.
Presence records are stored at presence/{channelId}/{userId}.
An onDisconnect hook ensures the record is marked offline even when the
client closes abnormally (app crash, network loss, etc.).
- Inheritance
-
- Object
- PresenceService
- FirebasePresenceService
Constructors
- FirebasePresenceService({FirebaseDatabase? database})
- Creates a FirebasePresenceService.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
{required String userId, required String channelId, Map< String, dynamic> ? metadata, String? displayName}) → Future<void> -
Marks
userIdas online in the given channel.override -
disconnect(
{required String userId, required String channelId}) → Future< void> -
Marks
userIdas offline in the given channel.override -
getOnlineUsers(
{required String channelId}) → Future< List< PresenceRecord> > -
Returns the current list of online users (one-time fetch).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
watchPresence(
{required String channelId}) → Stream< List< PresenceRecord> > -
Emits the list of currently online users whenever it changes.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited