anyway/frontend/lib/utils/load_trips.dart
Remy Moll 22ca038017
All checks were successful
Build and release APK / Build APK (pull_request) Successful in 5m18s
trip loading (from device storage) much improved
2024-08-09 11:39:11 +02:00

20 lines
538 B
Dart

import 'dart:collection';
import 'package:anyway/structs/trip.dart';
import 'package:anyway/structs/landmark.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future<List<Trip>> loadTrips() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
List<Trip> trips = [];
Set<String> keys = prefs.getKeys();
for (String key in keys) {
if (key.startsWith('trip_')) {
String uuid = key.replaceFirst('trip_', '');
trips.add(Trip.fromPrefs(prefs, uuid));
}
}
return trips;
}