import '../models/models.dart'; import '../services/repo_service.dart'; import 'package:flutter/material.dart'; class DescuentoViewModel extends ChangeNotifier { List descuentos = []; final RepoService repoService = RepoService(); Future cargarDescuentos() async { descuentos = await repoService.obtenerTodosDescuentos(); notifyListeners(); } Future guardarDescuento(Descuento descuento) async { await repoService.guardarDescuento(descuento); await cargarDescuentos(); } Future eliminarDescuento(int id) async { await repoService.eliminarDescuento(id); await cargarDescuentos(); } }