validate method
What is wrong with it, for a person; empty when nothing is. Never throws.
Implementation
List<String> validate() => [
for (final (name, v) in [
('metallic', metallic),
('roughness', roughness),
('opacity', opacity),
('alphaCutoff', alphaCutoff),
('occlusionStrength', occlusionStrength),
])
if (!v.isFinite || v < 0 || v > 1)
'"$name" is ${_shown(v)}; it goes from 0 to 1.',
if (!emissionStrength.isFinite || emissionStrength < 0)
'"emissionStrength" is ${_shown(emissionStrength)}; it cannot be below 0.',
for (final (name, v) in [('tilingX', tilingX), ('tilingY', tilingY)])
if (!v.isFinite || v <= 0) '"$name" is ${_shown(v)}; it must be above 0.',
for (final (name, v) in [
('offsetX', offsetX),
('offsetY', offsetY),
('rotation', rotation),
])
if (!v.isFinite) '"$name" is ${_shown(v)}; it must be a number.',
if (opacity < 1 && alpha != MaterialAlpha.blend)
'Its opacity is ${_shown(opacity)}, which only counts when it blends '
'("alpha": "blend").',
if (kind == MaterialKind.layered && layers.isEmpty)
'A layered material blends layers, and this one has none.',
if (layers.length > maxLayers)
'It blends ${layers.length} layers; at most $maxLayers are drawn.',
for (final layer in layers)
if (!isMaterialPath(layer)) 'Layer "$layer" is not a $ending file.',
if (isVariant && !isMaterialPath(parent))
'Its parent "$parent" is not a $ending file.',
for (final key in overrides)
if (!keys.contains(key))
'It overrides "$key", which a material does not have.',
];