handleUpdateTenant method
Handles the update of tenant data.
Fetches the list of tenants from the repository and triggers TenantLoadedEvent with the fetched tenants. If an error occurs, it logs the error and optionally handles it.
Implementation
Future<void> handleUpdateTenant() async {
try {
final tenants = await portalRepo.listTenant();
add(TenantLoadedEvent(tenants));
} catch (error) {
if (error is Exception) {
// Log the error or handle it as needed.
debugPrint("Error fetching tenants: $error");
rethrow;
}
}
}