getUserProfile static method
Future<void>
getUserProfile({
- required String jid,
- bool fetchFromServer = false,
- bool saveAsFriend = false,
- required dynamic flyCallback(
- FlyResponse response
Retrieves the user profile from the Mirrorfly server.
Retrieves the user profile associated with the provided jid
.
Optionally, the profile can be fetched from the server if fetchFromServer
is set to true.
If fetchFromServer
is false, the profile is retrieved from the local DB.
The flyCallback
function is invoked with a FlyResponse object as a parameter,
providing information about the success or failure of the operation.
Example usage:
await Mirrorfly.getUserProfile(
jid: 'user123',
fetchFromServer: true,
flyCallback: (response) {
if (response.isSuccess) {
var data = profileDataFromJson(response.data);
print('User profile retrieved successfully: ${response.data}');
} else {
print('Failed to retrieve user profile: ${response.errorMessage}');
}
},
);
Implementation
static Future<void> getUserProfile({
required String jid,
bool fetchFromServer = false,
bool saveAsFriend = false,
required Function(FlyResponse response) flyCallback,
}) {
return FlyChatFlutterPlatform.instance
.getUserProfile(jid, flyCallback, fetchFromServer, saveAsFriend);
}