listFromJson static method
Implementation
static List<SupervisorService>? listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <SupervisorService>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SupervisorService.fromJson(row);
if (value?.name != null &&
LbSetupEnvironment.SUPERVISOR_SERVICES_HIDE
.any((element) => value!.name!.contains(element))) {
continue;
}
if (value != null) {
try {
value.name = value.name?.split('lb_')[1];
} catch (e) {
// In case the name is not in the expected format
LogbotLogger().warning("Failed to parse service name",
"Service name does not match the expected format: ${value.name}");
} finally {
result.add(value);
}
}
}
}
return result.toList(growable: growable);
}