update method
Updates user data, if there is a logged in user.
Implementation
Future<GotrueUserResponse> update(UserAttributes attributes) async {
if (currentSession?.accessToken == null) {
final error = GotrueError('Not logged in.');
return GotrueUserResponse(error: error);
}
final response =
await api.updateUser(currentSession!.accessToken, attributes);
if (response.error != null) return response;
currentUser = response.user;
currentSession = currentSession?.copyWith(user: response.user);
_notifyAllSubscribers(AuthChangeEvent.userUpdated);
return response;
}