getUserProfile method
Get user profile information.
If not logged in or error during request than return null
.
Implementation
Future<FacebookUserProfile?> getUserProfile() async {
if (await isLoggedIn == false) {
if (debug) _log('Not logged in. User profile is null');
return null;
}
try {
final profileData =
await _channel.invokeMethod<Map>(_methodGetUserProfile);
if (debug) _log('User profile: $profileData');
if (profileData != null) {
return FacebookUserProfile.fromMap(profileData.cast<String, dynamic>());
}
} on PlatformException catch (e) {
if (debug) _log('Get profile error: $e');
}
return null;
}