Files
packet/lib/domain/entities/destino.dart

47 lines
1003 B
Dart
Raw Normal View History

class Destino {
final int? id;
final String nombre;
final String url;
final String hash;
final bool activo;
Destino({
this.id,
required this.nombre,
required this.url,
required this.hash,
this.activo = true,
});
factory Destino.fromMap(Map<String, dynamic> map) => Destino(
id: map['id'] as int?,
nombre: map['nombre'] as String,
url: map['url'] as String,
hash: map['hash'] as String,
activo: (map['activo'] as int?) == 1,
);
Map<String, dynamic> toMap() => {
if (id != null) 'id': id,
'nombre': nombre,
'url': url,
'hash': hash,
'activo': activo ? 1 : 0,
};
Destino copyWith({
int? id,
String? nombre,
String? url,
String? hash,
bool? activo,
}) =>
Destino(
id: id ?? this.id,
nombre: nombre ?? this.nombre,
url: url ?? this.url,
hash: hash ?? this.hash,
activo: activo ?? this.activo,
);
}