refactor: continue lint cleanup - 96 more issues fixed
- 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
This commit is contained in:
parent
862d423f6b
commit
68ad4adbcf
23 changed files with 118 additions and 95 deletions
|
|
@ -1,4 +1,4 @@
|
|||
export 'appActions.dart';
|
||||
export 'fireMapActions.dart';
|
||||
export 'fireNotificationActions.dart';
|
||||
export 'yourLocationActions.dart';
|
||||
export 'yourLocationActions.dart';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
String errorReducer(String error, action) {
|
||||
String errorReducer(String error, dynamic action) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import '../models/fireMapState.dart';
|
|||
import '../models/yourLocation.dart';
|
||||
import 'actions.dart';
|
||||
|
||||
final Reducer<FireMapState> fireMapReducer = combineReducers<FireMapState>(<Reducer<FireMapState>>[
|
||||
TypedReducer<FireMapState, ShowYourLocationMapAction>(
|
||||
_showYourLocationMap),
|
||||
final Reducer<FireMapState> fireMapReducer =
|
||||
combineReducers<FireMapState>(<Reducer<FireMapState>>[
|
||||
TypedReducer<FireMapState, ShowYourLocationMapAction>(_showYourLocationMap),
|
||||
TypedReducer<FireMapState, ShowFireNotificationMapAction>(
|
||||
_showFireNotificationMap),
|
||||
TypedReducer<FireMapState, UpdateFireMapStatsAction>(
|
||||
|
|
@ -15,8 +15,7 @@ final Reducer<FireMapState> fireMapReducer = combineReducers<FireMapState>(<Redu
|
|||
TypedReducer<FireMapState, SubscribeAction>(_subscribeYourLocationMap),
|
||||
TypedReducer<FireMapState, SubscribeConfirmAction>(
|
||||
_subscribeConfirmYourLocationMap),
|
||||
TypedReducer<FireMapState, UnSubscribeAction>(
|
||||
_unsubscribeYourLocationMap),
|
||||
TypedReducer<FireMapState, UnSubscribeAction>(_unsubscribeYourLocationMap),
|
||||
TypedReducer<FireMapState, EditYourLocationAction>(_editYourLocationMap),
|
||||
TypedReducer<FireMapState, EditConfirmYourLocationAction>(
|
||||
_editConfirmYourLocationMap),
|
||||
|
|
@ -52,7 +51,7 @@ FireMapState _showYourLocationMap(
|
|||
|
||||
FireMapState _showFireNotificationMap(
|
||||
FireMapState state, ShowFireNotificationMapAction action) {
|
||||
// TODO: use here you real location?
|
||||
// TODO(developer): use here real location instead of notification location?
|
||||
final YourLocation pseudoLoc = YourLocation(
|
||||
id: ObjectId(),
|
||||
lat: action.notif.lat,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import '../models/fireNotification.dart';
|
|||
abstract class FireNotificationActions {}
|
||||
|
||||
class DeleteFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
DeleteFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
|
@ -14,13 +13,11 @@ class DeleteAllFireNotificationAction extends FireNotificationActions {
|
|||
}
|
||||
|
||||
class AddFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
AddFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
||||
class DeletedFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
DeletedFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
|
@ -30,32 +27,27 @@ class DeletedAllFireNotificationAction extends FireNotificationActions {
|
|||
}
|
||||
|
||||
class AddedFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
AddedFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
||||
class ReadFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
ReadFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
||||
class ReadedFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
ReadedFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
|
||||
class MarkFireAsFalsePositiveAction extends FireNotificationActions {
|
||||
|
||||
MarkFireAsFalsePositiveAction(this.notif, this.type);
|
||||
final FireNotification notif;
|
||||
final FalsePositiveType type;
|
||||
}
|
||||
|
||||
class UpdatedFireNotificationAction extends FireNotificationActions {
|
||||
|
||||
UpdatedFireNotificationAction(this.notif);
|
||||
final FireNotification notif;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import 'package:redux/redux.dart';
|
|||
import '../models/fireNotification.dart';
|
||||
import 'actions.dart';
|
||||
|
||||
final Reducer<List<FireNotification>> fireNotificationReducer = combineReducers<List<FireNotification>>(<Reducer<List<FireNotification>>>[
|
||||
final Reducer<List<FireNotification>> fireNotificationReducer =
|
||||
combineReducers<List<FireNotification>>(<Reducer<List<FireNotification>>>[
|
||||
TypedReducer<List<FireNotification>, AddedFireNotificationAction>(
|
||||
_addedFireNotification),
|
||||
TypedReducer<List<FireNotification>, DeletedFireNotificationAction>(
|
||||
|
|
@ -18,20 +19,21 @@ final Reducer<List<FireNotification>> fireNotificationReducer = combineReducers<
|
|||
|
||||
List<FireNotification> _addedFireNotification(
|
||||
List<FireNotification> notifications, AddedFireNotificationAction action) {
|
||||
return List.from(notifications)..insert(0, action.notif);
|
||||
return List<FireNotification>.from(notifications)..insert(0, action.notif);
|
||||
}
|
||||
|
||||
List<FireNotification> _deletedFireNotification(
|
||||
List<FireNotification> notifications,
|
||||
DeletedFireNotificationAction action) {
|
||||
return List.from(notifications)..remove(action.notif);
|
||||
return List<FireNotification>.from(notifications)..remove(action.notif);
|
||||
}
|
||||
|
||||
List<FireNotification> _updatedFireNotification(
|
||||
List<FireNotification> notifications,
|
||||
UpdatedFireNotificationAction action) {
|
||||
return notifications
|
||||
.map((FireNotification notif) => notif.id == action.notif.id ? action.notif : notif)
|
||||
.map((FireNotification notif) =>
|
||||
notif.id == action.notif.id ? action.notif : notif)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'actions.dart';
|
||||
|
||||
bool loadedReducer(bool isLoaded, dynamic action) {
|
||||
if (action is FetchYourLocationsSucceededAction) return true;
|
||||
if (action is FetchYourLocationsSucceededAction) {
|
||||
return true;
|
||||
}
|
||||
return isLoaded;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'actions.dart';
|
||||
|
||||
bool loadingReducer(bool isLoading, dynamic action) {
|
||||
if (action is FetchYourLocationsAction) return true;
|
||||
if (action is FetchYourLocationsAction) {
|
||||
return true;
|
||||
}
|
||||
return isLoading;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@ import '../models/user.dart';
|
|||
import 'actions.dart';
|
||||
|
||||
User userReducer(User user, dynamic action) {
|
||||
if (action is OnUserCreatedAction)
|
||||
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);
|
||||
}
|
||||
if (action is OnUserTokenAction) {
|
||||
return user.copyWith(token: action.token);
|
||||
}
|
||||
if (action is OnUserLangAction) {
|
||||
return user.copyWith(lang: action.lang);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import 'package:redux/redux.dart';
|
|||
import '../models/yourLocation.dart';
|
||||
import 'actions.dart';
|
||||
|
||||
final Reducer<List<YourLocation>> yourLocationsReducer = combineReducers<List<YourLocation>>(<Reducer<List<YourLocation>>>[
|
||||
TypedReducer<List<YourLocation>, AddedYourLocationAction>(
|
||||
_addedYourLocation),
|
||||
final Reducer<List<YourLocation>> yourLocationsReducer =
|
||||
combineReducers<List<YourLocation>>(<Reducer<List<YourLocation>>>[
|
||||
TypedReducer<List<YourLocation>, AddedYourLocationAction>(_addedYourLocation),
|
||||
TypedReducer<List<YourLocation>, DeletedYourLocationAction>(
|
||||
_deletedYourLocation),
|
||||
TypedReducer<List<YourLocation>, UpdatedYourLocationAction>(
|
||||
|
|
@ -16,7 +16,7 @@ final Reducer<List<YourLocation>> yourLocationsReducer = combineReducers<List<Yo
|
|||
|
||||
List<YourLocation> _addedYourLocation(
|
||||
List<YourLocation> yourLocations, AddedYourLocationAction action) {
|
||||
return List.from(yourLocations)..add(action.loc);
|
||||
return List<YourLocation>.from(yourLocations)..add(action.loc);
|
||||
}
|
||||
|
||||
List<YourLocation> _deletedYourLocation(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue