- Add @immutable to classes with ==/hashCode (homePage, basicLocation, fireNotification, yourLocation, monitoredAreas) - Fix camel_case_types (genericMap → GenericMap) - Fix avoid_dynamic_calls (firesApi - typed responses) - Fix use_build_context_synchronously (locationUtils) - Fix always_put_control_body_on_new_line (4 reducers) - Fix always_specify_types (placesAutocompleteUtils, reducers) - Fix eol_at_end_of_file (4 files) - Fix prefer_function_declarations_over_variables (introPage) - Fix flutter_style_todos (fireMapReducer) Build: APK generated, 0 errors, 0 warnings
15 lines
382 B
Dart
15 lines
382 B
Dart
import '../models/user.dart';
|
|
import 'actions.dart';
|
|
|
|
User userReducer(User user, dynamic action) {
|
|
if (action is OnUserCreatedAction) {
|
|
return user.copyWith(userId: action.userId);
|
|
}
|
|
if (action is OnUserTokenAction) {
|
|
return user.copyWith(token: action.token);
|
|
}
|
|
if (action is OnUserLangAction) {
|
|
return user.copyWith(lang: action.lang);
|
|
}
|
|
return user;
|
|
}
|