Fix remaining compilation errors: null-safety, removed packages, and nullable handling
- Fix AppState: remove removed connectivity package, fix imports (latlong2), make nullable fields optional - Fix User model: use const empty strings in const constructor instead of null - Fix model builders: add required ObjectId parameters to YourLocation and FireNotification - Implement Comparable instead of extending it for BasicLocation - Fix nullable callback handling in appActions and middleware (Completer<Null>?) - Add null checks for BuildContext in dialogs (fireAlert, homePage, etc.) - Fix nullable scaffold state access using ?. operator (activeFires, fireNotificationList) - Handle nullable FireNotification and YourLocation in genericMapBottom - Fix list type casting for widgets that can be null (<Widget?> with filtering) - Add ObjectId imports where needed for model creation - Fix Key? nullable parameter in introPage - Add required parameters to markdownPage and slider constructors - Remove connectivity-related code and imports (package removed) - Handle nullable Completer in fetchDataMiddleware All 104 errors resolved. 0 errors, 61 warnings/info remaining.
This commit is contained in:
parent
037b5eaa32
commit
a7f3ab6974
27 changed files with 259 additions and 274 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:redux/redux.dart';
|
||||
import 'package:fires_flutter/models/yourLocation.dart';
|
||||
import 'package:objectid/objectid.dart';
|
||||
import '../models/fireMapState.dart';
|
||||
import 'actions.dart';
|
||||
|
||||
|
|
@ -7,7 +8,7 @@ final fireMapReducer = combineReducers<FireMapState>([
|
|||
new TypedReducer<FireMapState, ShowYourLocationMapAction>(
|
||||
_showYourLocationMap),
|
||||
new TypedReducer<FireMapState, ShowFireNotificationMapAction>(
|
||||
_showFireNotificationMap),
|
||||
_showFireNotificationMap),
|
||||
new TypedReducer<FireMapState, UpdateFireMapStatsAction>(
|
||||
_updateYourLocationMapStats),
|
||||
new TypedReducer<FireMapState, SubscribeAction>(_subscribeYourLocationMap),
|
||||
|
|
@ -20,8 +21,7 @@ final fireMapReducer = combineReducers<FireMapState>([
|
|||
_editConfirmYourLocationMap),
|
||||
new TypedReducer<FireMapState, EditCancelYourLocationAction>(
|
||||
_editCancelYourLocationMap),
|
||||
new TypedReducer<FireMapState, ToggleMapLayerAction>(
|
||||
_toggleMapLayer),
|
||||
new TypedReducer<FireMapState, ToggleMapLayerAction>(_toggleMapLayer),
|
||||
new TypedReducer<FireMapState, UpdateYourLocationMapAction>(
|
||||
_updateYourLocationMap)
|
||||
]);
|
||||
|
|
@ -46,15 +46,22 @@ FireMapState _showYourLocationMap(
|
|||
status: action.loc.subscribed
|
||||
? FireMapStatus.unsubscribe
|
||||
: FireMapStatus.view,
|
||||
yourLocation: action.loc, fireNotication: null);
|
||||
yourLocation: action.loc,
|
||||
fireNotication: null);
|
||||
}
|
||||
|
||||
FireMapState _showFireNotificationMap(
|
||||
FireMapState state, ShowFireNotificationMapAction action) {
|
||||
// TODO: use here you real location?
|
||||
YourLocation pseudoLoc = new YourLocation(lat: action.notif.lat, lon: action.notif.lon, description: action.notif.description);
|
||||
YourLocation pseudoLoc = new YourLocation(
|
||||
id: ObjectId(),
|
||||
lat: action.notif.lat,
|
||||
lon: action.notif.lon,
|
||||
description: action.notif.description);
|
||||
return state.copyWith(
|
||||
status: FireMapStatus.viewFireNotification, yourLocation: pseudoLoc, fireNotication: action.notif);
|
||||
status: FireMapStatus.viewFireNotification,
|
||||
yourLocation: pseudoLoc,
|
||||
fireNotication: action.notif);
|
||||
}
|
||||
|
||||
FireMapState _subscribeYourLocationMap(
|
||||
|
|
@ -92,12 +99,12 @@ FireMapState _editCancelYourLocationMap(
|
|||
FireMapStatus restoreStatusAfterSave(loc) =>
|
||||
loc.subscribed ? FireMapStatus.unsubscribe : FireMapStatus.view;
|
||||
|
||||
FireMapState _toggleMapLayer(
|
||||
FireMapState state, ToggleMapLayerAction action) {
|
||||
FireMapState _toggleMapLayer(FireMapState state, ToggleMapLayerAction action) {
|
||||
FireMapLayer currentLayer = state.layer;
|
||||
List<FireMapLayer> list = FireMapLayer.values;
|
||||
int currentPos = list.indexOf(currentLayer);
|
||||
currentPos++;
|
||||
FireMapLayer next = list.elementAt(currentPos >= list.length ? 0: currentPos);
|
||||
FireMapLayer next =
|
||||
list.elementAt(currentPos >= list.length ? 0 : currentPos);
|
||||
return state.copyWith(layer: next);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue