feat(quality): harden lint rules and add quality-gate tests
This commit is contained in:
@@ -136,7 +136,11 @@ class Emisora {
|
||||
/// Lista de géneros/tags como lista limpia.
|
||||
List<String> get generos {
|
||||
if (tags == null || tags!.isEmpty) return [];
|
||||
return tags!.split(',').map((t) => t.trim()).where((t) => t.isNotEmpty).toList();
|
||||
return tags!
|
||||
.split(',')
|
||||
.map((t) => t.trim())
|
||||
.where((t) => t.isNotEmpty)
|
||||
.toList();
|
||||
}
|
||||
|
||||
static String? _nonEmpty(String? s) =>
|
||||
@@ -148,7 +152,9 @@ class Emisora {
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is Emisora && runtimeType == other.runtimeType && uuid == other.uuid;
|
||||
other is Emisora &&
|
||||
runtimeType == other.runtimeType &&
|
||||
uuid == other.uuid;
|
||||
|
||||
@override
|
||||
int get hashCode => uuid.hashCode;
|
||||
|
||||
@@ -5,21 +5,47 @@ class PresetEcualizador {
|
||||
final List<double> bandas; // 5 valores entre -12.0 y +12.0 dB
|
||||
|
||||
const PresetEcualizador({required this.nombre, required this.bandas})
|
||||
: assert(bandas.length == 5);
|
||||
: assert(bandas.length == 5);
|
||||
|
||||
static final flat = PresetEcualizador(nombre: 'Flat', bandas: [0.0, 0.0, 0.0, 0.0, 0.0]);
|
||||
static final rock = PresetEcualizador(nombre: 'Rock', bandas: [2.0, 1.0, -1.0, 2.0, 3.0]);
|
||||
static final pop = PresetEcualizador(nombre: 'Pop', bandas: [1.0, 1.5, 0.5, 1.0, 1.5]);
|
||||
static final bassBoost = PresetEcualizador(nombre: 'Bass Boost', bandas: [5.0, 3.0, -1.0, 0.5, 0.0]);
|
||||
static final jazz = PresetEcualizador(nombre: 'Jazz', bandas: [3.0, -1.0, -1.5, 2.0, 4.0]);
|
||||
static final voz = PresetEcualizador(nombre: 'Voz', bandas: [-2.0, -1.0, 2.0, 3.0, 1.0]);
|
||||
static final flat = PresetEcualizador(
|
||||
nombre: 'Flat',
|
||||
bandas: [0.0, 0.0, 0.0, 0.0, 0.0],
|
||||
);
|
||||
static final rock = PresetEcualizador(
|
||||
nombre: 'Rock',
|
||||
bandas: [2.0, 1.0, -1.0, 2.0, 3.0],
|
||||
);
|
||||
static final pop = PresetEcualizador(
|
||||
nombre: 'Pop',
|
||||
bandas: [1.0, 1.5, 0.5, 1.0, 1.5],
|
||||
);
|
||||
static final bassBoost = PresetEcualizador(
|
||||
nombre: 'Bass Boost',
|
||||
bandas: [5.0, 3.0, -1.0, 0.5, 0.0],
|
||||
);
|
||||
static final jazz = PresetEcualizador(
|
||||
nombre: 'Jazz',
|
||||
bandas: [3.0, -1.0, -1.5, 2.0, 4.0],
|
||||
);
|
||||
static final voz = PresetEcualizador(
|
||||
nombre: 'Voz',
|
||||
bandas: [-2.0, -1.0, 2.0, 3.0, 1.0],
|
||||
);
|
||||
|
||||
static final presets = [flat, rock, pop, bassBoost, jazz, voz];
|
||||
|
||||
factory PresetEcualizador.desdeJson(Map<String, dynamic> json) {
|
||||
final raw = (json['bandas'] as List?)?.map((e) => (e as num).toDouble()).toList() ?? <double>[];
|
||||
final bandas = List<double>.generate(5, (i) => i < raw.length ? raw[i] : 0.0);
|
||||
return PresetEcualizador(nombre: json['nombre'] as String? ?? 'Personalizado', bandas: bandas);
|
||||
final raw =
|
||||
(json['bandas'] as List?)?.map((e) => (e as num).toDouble()).toList() ??
|
||||
<double>[];
|
||||
final bandas = List<double>.generate(
|
||||
5,
|
||||
(i) => i < raw.length ? raw[i] : 0.0,
|
||||
);
|
||||
return PresetEcualizador(
|
||||
nombre: json['nombre'] as String? ?? 'Personalizado',
|
||||
bandas: bandas,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {'nombre': nombre, 'bandas': bandas};
|
||||
|
||||
Reference in New Issue
Block a user