WT1.1.11 Null-Safe migration

This commit is contained in:
bossanyit
2021-04-02 11:42:26 +02:00
parent a656562c49
commit 01148c6e39
219 changed files with 3208 additions and 5334 deletions
+4 -4
View File
@@ -16,9 +16,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
final CustomerRepository customerRepository;
bool loggedIn = false;
int traineeId = 0;
AccountBloc({this.customerRepository}) : super(AccountInitial()) {
AccountBloc({required this.customerRepository}) : super(AccountInitial()) {
if (Cache().userLoggedIn != null) {
customerRepository.customer = Cache().userLoggedIn;
customerRepository.customer = Cache().userLoggedIn!;
loggedIn = true;
}
}
@@ -74,7 +74,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
yield AccountLoggedIn();
} else if (event is AccountLogout) {
await Cache().logout();
customerRepository.customer = null;
//customerRepository.customer = null;
customerRepository.emptyTrainees();
loggedIn = false;
yield AccountLoggedOut();
@@ -85,7 +85,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
} else if (event is AccountSelectTrainee) {
yield AccountLoading();
customerRepository.setTrainee(event.traineeId);
Cache().setTrainee(customerRepository.getTraineeById(event.traineeId));
Cache().setTrainee(customerRepository.getTraineeById(event.traineeId)!);
ExerciseRepository exerciseRepository = ExerciseRepository();
await exerciseRepository.getExercisesByCustomer(event.traineeId);
this.traineeId = event.traineeId;
+6 -22
View File
@@ -9,37 +9,21 @@ abstract class AccountEvent extends Equatable {
}
class AccountChangeCustomer extends AccountEvent {
final Customer customer;
const AccountChangeCustomer({this.customer});
@override
List<Object> get props => [customer];
const AccountChangeCustomer();
}
class AccountLogout extends AccountEvent {
final Customer customer;
const AccountLogout({this.customer});
@override
List<Object> get props => [customer];
const AccountLogout();
}
class AccountLogin extends AccountEvent {
final Customer customer;
const AccountLogin({this.customer});
@override
List<Object> get props => [customer];
const AccountLogin();
}
class AccountLogInFinished extends AccountEvent {
final Customer customer;
const AccountLogInFinished({this.customer});
const AccountLogInFinished({required this.customer});
@override
List<Object> get props => [customer];
@@ -51,8 +35,8 @@ class AccountGetTrainees extends AccountEvent {
class AccountSelectTrainee extends AccountEvent {
final int traineeId;
const AccountSelectTrainee({this.traineeId});
const AccountSelectTrainee({required this.traineeId});
@override
List<Object> get props => [traineeId];
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ class AccountLoggedIn extends AccountState {
class AccountError extends AccountState {
final String message;
const AccountError({this.message});
const AccountError({required this.message});
@override
List<Object> get props => [message];