copyWith method

  1. @override
IdentityState copyWith({
  1. Set<LoadingState>? loadingStates,
  2. Set<Message>? messages,
  3. Session? session,
  4. bool? isLoggedIn,
  5. User? user,
  6. String? accessToken,
  7. String? defaultOrgId,
  8. List<String>? orgMemberships,
  9. String? defaultSpaceId,
  10. List<String>? spaceMemberships,
  11. dynamic resetToken = false,
  12. Verification? awaitingVerification,
  13. dynamic resetAwaitingVerification = false,
  14. AuthType? awaitingLogin,
  15. dynamic resetAwaitingLogin = false,
  16. String? totpSetupSecret,
  17. Uri? totpSetupUri,
  18. dynamic resetTOTPSetup = false,
})
override

The concrete class must implement this method to return a new instance of the state with the given parameters.

Implementation

@override
IdentityState copyWith({
  Set<LoadingState>? loadingStates,
  Set<Message>? messages,
  Session? session,
  bool? isLoggedIn,
  User? user,
  String? accessToken,
  String? defaultOrgId,
  List<String>? orgMemberships,
  String? defaultSpaceId,
  List<String>? spaceMemberships,
  resetToken = false,
  Verification? awaitingVerification,
  resetAwaitingVerification = false,
  AuthType? awaitingLogin,
  resetAwaitingLogin = false,
  String? totpSetupSecret,
  Uri? totpSetupUri,
  resetTOTPSetup = false,
}) {
  return IdentityState(
    loadingStates: loadingStates ?? super.loadingStates,
    messages: messages ?? super.messages,
    session: session ?? this.session,
    isLoggedIn: isLoggedIn ?? this.isLoggedIn,
    user: user ?? this.user,
    accessToken: resetToken //
        ? null
        : accessToken ?? this.accessToken,
    defaultOrgId: resetToken //
        ? null
        : defaultOrgId ?? this.defaultOrgId,
    orgMemberships: resetToken //
        ? null
        : orgMemberships ?? this.orgMemberships,
    defaultSpaceId: resetToken //
        ? null
        : defaultSpaceId ?? this.defaultSpaceId,
    spaceMemberships: resetToken //
        ? null
        : spaceMemberships ?? this.spaceMemberships,
    awaitingVerification: //
        resetAwaitingVerification //
            ? null
            : awaitingVerification ?? this.awaitingVerification,
    awaitingLogin: //
        resetAwaitingLogin //
            ? null
            : awaitingLogin ?? this.awaitingLogin,
    totpSetupSecret: //
        resetTOTPSetup //
            ? null
            : totpSetupSecret ?? this.totpSetupSecret,
    totpSetupUri: //
        resetTOTPSetup //
            ? null
            : totpSetupUri ?? this.totpSetupUri,
  );
}