copy method

AuthResponse copy({
  1. bool? isCancel,
  2. bool? isSuccessful,
  3. bool? isLoading,
  4. bool? isLoggedIn,
  5. bool? isFailed,
  6. User? firebaseUser,
  7. UserEntity? user,
  8. String? message,
  9. String? error,
  10. AuthStatus? status,
})

Implementation

AuthResponse copy({
  bool? isCancel,
  bool? isSuccessful,
  bool? isLoading,
  bool? isLoggedIn,
  bool? isFailed,
  User? firebaseUser,
  UserEntity? user,
  String? message,
  String? error,
  AuthStatus? status,
}) {
  var successful = (user != null || firebaseUser != null ||
      message != null)
      ? true
      : this.isSuccessful;
  return AuthResponse(
    isCancel: isCancel ?? this.isCancel,
    isLoading: isLoading ?? this.isLoading,
    isLoggedIn: isLoggedIn ?? this.isLoggedIn,
    isSuccessful: isSuccessful ?? successful,
    isFailed: isFailed ?? this.isFailed,
    firebaseUser: firebaseUser ?? this.firebaseUser,
    user: user ?? this.user,
    message:
    message ?? (isSuccessful ?? false ? "Successful!" : this.message),
    error: error ?? this.error,
    status: status ??
        (firebaseUser != null
            ? AuthStatus.ok
            : (message != null ? AuthStatus.notFound : this.status)),
  );
}