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:
parent
1864e5b105
commit
7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions
|
|
@ -2,30 +2,31 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:comunes_flutter/comunes_flutter.dart';
|
||||
import 'package:fires_flutter/models/yourLocation.dart';
|
||||
import 'package:shared_preferences/src/shared_preferences_legacy.dart';
|
||||
|
||||
import '../globals.dart' as globals;
|
||||
import 'yourLocation.dart';
|
||||
|
||||
final String locationKey = 'yourlocations';
|
||||
const String locationKey = 'yourlocations';
|
||||
|
||||
Future<List<YourLocation>> loadYourLocations() async {
|
||||
return await globals.prefs.then((prefs) {
|
||||
List<String>? yourLocations = prefs.getStringList(locationKey);
|
||||
List<YourLocation> persistedList = [];
|
||||
(yourLocations ?? []).forEach((locationString) {
|
||||
Map<String, dynamic> locationMap =
|
||||
return globals.prefs.then((SharedPreferences prefs) {
|
||||
final List<String>? yourLocations = prefs.getStringList(locationKey);
|
||||
final List<YourLocation> persistedList = <YourLocation>[];
|
||||
for (final String locationString in (yourLocations ?? <String>[])) {
|
||||
final Map<String, dynamic> locationMap =
|
||||
json.decode(locationString) as Map<String, dynamic>;
|
||||
persistedList.add(YourLocation.fromJson(locationMap));
|
||||
});
|
||||
}
|
||||
return persistedList;
|
||||
});
|
||||
}
|
||||
|
||||
persistYourLocations(List<YourLocation> yl) {
|
||||
void persistYourLocations(List<YourLocation> yl) {
|
||||
// debugPrint('Persisting $yl');
|
||||
globals.prefs.then((prefs) {
|
||||
List<String> ylAsString = [];
|
||||
yl.where(notNull).toList().forEach((location) {
|
||||
globals.prefs.then((SharedPreferences prefs) {
|
||||
final List<String> ylAsString = <String>[];
|
||||
yl.where(notNull).toList().forEach((YourLocation location) {
|
||||
ylAsString.add(json.encode(location.toJson()));
|
||||
});
|
||||
prefs.setStringList(locationKey, ylAsString);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue