getUserLastSeenTime static method
- required String jid,
- required dynamic flyCallBack(
- FlyResponse response
Retrieves the last seen time of a user identified by their JID.
This method asynchronously fetches and returns the last seen time of the user associated with the provided JID. The JID uniquely identifies a user within the Mirrorfly chat platform.
The jid
parameter is required and represents the JID of the user whose last
seen time is to be retrieved.
The flyCallBack
parameter is a function that will be called upon completion of the operation.
It receives a FlyResponse object as a parameter, which contains information about the success or failure of the operation.
Returns a data
that completes with a String representing the last seen
time in DateTime.fromMillisecondsSinceEpoch of the user, or null
if the last seen time is not available or an error
occurs during the retrieval process.
Example:
Mirrorfly.getUserLastSeenTime(jid: 'user123@domain.com',flyCallBack: (response){
if(response.isSuccess){
String lastSeenTime = response.data;
if (lastSeenTime.isNotEmpty) {
DateTime lastSeen = DateTime.fromMillisecondsSinceEpoch(int.parse(seconds), isUtc: false);
print('Last seen time: $lastSeen');
} else {
print('Last seen time is not available.');
}
}
});
Implementation
static Future<void> getUserLastSeenTime(
{required String jid,
required Function(FlyResponse response) flyCallBack}) {
return FlyChatFlutterPlatform.instance
.getUserLastSeenTime(jid, flyCallBack);
}