selfprivacy.org.app/lib/logic/cubit/users/users_state.dart

31 lines
769 B
Dart
Raw Normal View History

2020-12-03 16:52:53 +00:00
part of 'users_cubit.dart';
class UsersState extends ServerInstallationDependendState {
const UsersState(this.users, this.rootUser, this.primaryUser);
2020-12-03 16:52:53 +00:00
final List<User> users;
final User rootUser;
final User primaryUser;
2020-12-03 16:52:53 +00:00
@override
List<Object> get props => [users, rootUser, primaryUser];
UsersState copyWith({
2022-06-05 19:36:32 +00:00
final List<User>? users,
final User? rootUser,
final User? primaryUser,
}) =>
UsersState(
users ?? this.users,
rootUser ?? this.rootUser,
primaryUser ?? this.primaryUser,
);
2021-01-06 17:35:57 +00:00
bool isLoginRegistered(final String login) =>
users.any((final User user) => user.login == login) ||
login == rootUser.login ||
login == primaryUser.login;
2021-01-06 17:35:57 +00:00
bool get isEmpty => users.isEmpty;
2020-12-03 16:52:53 +00:00
}