setCurrentUser method

  1. @protected
  2. @nonVirtual
void setCurrentUser(
  1. User user
)

Sets the signed-in user, adds it to userChanges and emits a UserChangedEvent, so features can react with an EventHandler or re-check their redirects with refreshOn: [UserChangedEvent].

Implementation

@protected
@nonVirtual
void setCurrentUser(User user) {
  _currentUser = user;
  controller.add(user);
  try {
    VyuhBinding.instance.event.emit(UserChangedEvent(user));
  } catch (_) {
    // No event plugin yet, such as a plugin used on its own in a test.
  }
}