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