class Pack { final int? id; final String nombre; final String icono; final List tags; Pack({ this.id, required this.nombre, this.icono = '📦', required this.tags, }); factory Pack.fromMap(Map map) => Pack( id: map['id'] as int?, nombre: map['nombre'] as String, icono: map['icono'] as String? ?? '📦', tags: (map['tags'] as String).split(',').where((t) => t.isNotEmpty).toList(), ); Map toMap() => { if (id != null) 'id': id, 'nombre': nombre, 'icono': icono, 'tags': tags.join(','), }; int get tagCount => tags.length; }