fix: Resolve Dart type inference errors and update Android build configuration for Gradle 8.14

Type Annotation Fixes:
- fireNotificationList.dart: Added DeleteFireNotificationFunction and TapFireNotificationFunction types to _buildRow and _buildSavedFireNotifications parameters
- homePage.dart: Added Object type to catchError handler parameters
- redux/appReducer.dart: Added dynamic type annotation to action parameter
- redux/fetchDataMiddleware.dart: Added explicit type annotations and improved type casting
- redux/reducers.dart: Added dynamic type annotation to action parameter
- redux/userReducer.dart: Added dynamic type annotation to action parameter

Android Build Configuration Updates:
- Updated compileSdkVersion and targetSdkVersion from 34 to 36 to match plugin requirements
- Moved plugins {} block to first position (Gradle 8.14 requirement)
- Added dev.flutter.flutter-gradle-plugin to plugins block for modern Flutter integration
- Removed deprecated useProguard setting, replaced with shrinkResources
- Disabled Jetifier (android.enableJetifier=false) to improve build performance
- Increased JVM heap allocation to 4096M for large project compilation
- Added Kotlin language version 1.8 override for plugin compatibility
- Added ProGuard rules to exclude optional Google Play Core classes

Build Results:
-  APK builds successfully (146MB debug APK)
-  Zero type inference errors detected by dart analyze
-  Kotlin compilation passes
-  R8 minification configured correctly
-  301 remaining issues are all INFO-level style suggestions (non-blocking)
This commit is contained in:
vjrj 2026-03-06 21:44:54 +01:00
parent 956165c524
commit 7812ed951e
19 changed files with 129 additions and 111 deletions

View file

@ -28,12 +28,13 @@ FiresApi api = GetIt.instance<FiresApi>();
// Simple debounce mechanism
Timer? _locationUpdateDebounceTimer;
void debounceLocationUpdate(Duration duration, Function() callback) {
void debounceLocationUpdate(Duration duration, void Function() callback) {
_locationUpdateDebounceTimer?.cancel();
_locationUpdateDebounceTimer = Timer(duration, callback);
}
void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
void fetchDataMiddleware(
Store<AppState> store, dynamic action, NextDispatcher next) {
// If our Middleware encounters a `FetchYourLocationAction`
if (action is OnUserLangAction) {
@ -112,7 +113,8 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
lat: action.loc.lat,
lon: action.loc.lon,
distance: action.loc.distance)
.then((UpdateFireMapStatsAction result) => store.dispatch(result)));
.then(
(UpdateFireMapStatsAction result) => store.dispatch(result)));
store.dispatch(UpdatedYourLocationAction(action.loc));
persistYourLocations(store.state.yourLocations);
}
@ -162,7 +164,8 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
print('Local persisted: ${localLocations.length}');
for (final YourLocation subsLoc in subscribedLocations) {
final YourLocation locSubs = localLocations.firstWhere(
(YourLocation localLocation) => localLocation.id == subsLoc.id, orElse: () {
(YourLocation localLocation) => localLocation.id == subsLoc.id,
orElse: () {
localLocations.add(subsLoc);
return subsLoc;
});
@ -188,10 +191,10 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
final Completer<void>? completer = action.refreshCallback;
completer?.complete(null);
});
}).catchError((Exception onError) {
}).catchError((Object onError) {
// If it fails, dispatch a failure action. The reducer will
// update the state with the error.
store.dispatch(FetchYourLocationsFailedAction(onError));
store.dispatch(FetchYourLocationsFailedAction(onError as Exception));
});
}
@ -257,15 +260,16 @@ void getFiresStatsInFire(Store<AppState> store, FireNotification notif) {
.then((UpdateFireMapStatsAction result) => store.dispatch(result));
}
void unsubsViaApi(Store<AppState> store, ObjectId id, onUnsubs) {
void unsubsViaApi(
Store<AppState> store, ObjectId id, void Function() onUnsubs) {
api.unsubscribe(store.state, id.hexString).then((bool res) {
onUnsubs();
persistYourLocations(store.state.yourLocations);
});
}
void subscribeViaApi(
Store<AppState> store, YourLocation loc, Function(YourLocation) onSubs) {
void subscribeViaApi(Store<AppState> store, YourLocation loc,
void Function(YourLocation) onSubs) {
api.subscribe(store.state, loc).then((String subsId) {
final YourLocation sub = loc;
// if (loc.id != subsId) {