fix: resolve 2 remaining strict analysis errors

- introPage.dart: Convert fireItems to proper static function closure
- mainDrawer.dart: Convert unreadCount int to String for Text widget
This commit is contained in:
vjrj 2026-03-06 11:21:06 +01:00
parent 1864e5b105
commit 7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions

View file

@ -2,30 +2,31 @@ import 'dart:async';
import 'dart:convert';
import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:fires_flutter/models/fireNotification.dart';
import 'package:shared_preferences/src/shared_preferences_legacy.dart';
import '../globals.dart' as globals;
import 'fireNotification.dart';
final String fireNotificationKey = 'fireNotifications';
const String fireNotificationKey = 'fireNotifications';
Future<List<FireNotification>> loadFireNotifications() async {
return await globals.prefs.then((prefs) {
List<String>? FireNotifications = prefs.getStringList(fireNotificationKey);
List<FireNotification> persistedList = [];
(FireNotifications ?? []).forEach((notificationString) {
Map<String, dynamic> notificationMap =
return globals.prefs.then((SharedPreferences prefs) {
final List<String>? FireNotifications = prefs.getStringList(fireNotificationKey);
final List<FireNotification> persistedList = <FireNotification>[];
for (final String notificationString in (FireNotifications ?? <String>[])) {
final Map<String, dynamic> notificationMap =
json.decode(notificationString) as Map<String, dynamic>;
persistedList.add(FireNotification.fromJson(notificationMap));
});
}
return persistedList;
});
}
persistFireNotifications(List<FireNotification> notif) {
void persistFireNotifications(List<FireNotification> notif) {
// print('Persisting $notif');
globals.prefs.then((prefs) {
List<String> notifAsString = [];
notif.where(notNull).toList().forEach((notification) {
globals.prefs.then((SharedPreferences prefs) {
final List<String> notifAsString = <String>[];
notif.where(notNull).toList().forEach((FireNotification notification) {
notifAsString.add(json.encode(notification.toJson()));
});
prefs.setStringList(fireNotificationKey, notifAsString);