saveProfiles method
Saves the profilesList in SharedPreferences so it can be loaded after closing the app
Implementation
Future<void> saveProfiles() async {
final prefs = await SharedPreferences.getInstance();
List<String> profilesJson =
profilesList.map((profile) => jsonEncode(profile.toJson())).toList();
await prefs.setStringList('profiles', profilesJson);
print('Saved: $profilesJson');
await prefs.setBool('dataExists', true);
}