import 'basico_model.dart'; import '../services/services.dart'; class Variable extends Basico { String? nombre; String? clave; String? descripcion; bool? activo; Variable({ super.id, this.nombre, this.clave, this.descripcion, this.activo = true, }); @override Map toJson() { return { 'id': id, 'nombre': nombre, 'clave': clave, 'descripcion': descripcion, 'activo': activo == true ? 1 : 0, }..addAll(super.toJson()); } Variable.fromJson(Map json) { super.parseJson(json); nombre = Basico.parseString(json['nombre']); clave = Basico.parseString(json['clave']); descripcion = Basico.parseString(json['descripcion']); activo = Basico.parseInt(json['activo']) == 1; } Future guardar() async { idLocal = await DatabaseService().guardar(this); } }