laad method
Implementation
Future<void> laad() async {
final prefs = await SharedPreferences.getInstance();
final json = prefs.getString(_keyGebruikers);
if (json != null) {
final list = jsonDecode(json) as List;
_gebruikers =
list.map((e) => Gebruiker.fromJson(e as Map<String, dynamic>)).toList();
}
_actieveGebruikerId = prefs.getString(_keyActief);
if (_actieveGebruikerId != null) {
final bestaat = _gebruikers.any((g) => g.id == _actieveGebruikerId);
if (!bestaat) {
_actieveGebruikerId = null;
} else {
await _projectenProvider.laadVoorGebruiker(_actieveGebruikerId!);
}
}
notifyListeners();
}