selfprivacy.org.app/lib/logic/cubit/users/users_state.dart
NaiJi 0d0a3a4fee Refactor App Config Cubit infrastrucute
Co-authored-by: Inex Code <inex.code@selfprivacy.org>
2022-05-17 16:31:34 +03:00

33 lines
746 B
Dart

part of 'users_cubit.dart';
class UsersState extends ServerInstallationDependendState {
const UsersState(this.users, this.rootUser, this.primaryUser);
final List<User> users;
final User rootUser;
final User primaryUser;
@override
List<Object> get props => [users, rootUser, primaryUser];
UsersState copyWith({
List<User>? users,
User? rootUser,
User? primaryUser,
}) {
return UsersState(
users ?? this.users,
rootUser ?? this.rootUser,
primaryUser ?? this.primaryUser,
);
}
bool isLoginRegistered(String login) {
return users.any((user) => user.login == login) ||
login == rootUser.login ||
login == primaryUser.login;
}
bool get isEmpty => users.isEmpty;
}