loadProfiles method

Future<void> loadProfiles()

Loads the profilesList from SharedPreferences. This function is called every time the app is launched

Implementation

Future<void> loadProfiles() async {
  final prefs = await SharedPreferences.getInstance();

  print('load checkpoint');
  List<String>? profilesJson = prefs.getStringList('profiles');
  if (profilesJson != null) {
    profilesList = profilesJson
        .map((profile) => Profile.fromJson(jsonDecode(profile)))
        .toList();
    profileCounter = profilesList.length;
    print('Loaded: $profilesJson');
  }


}