apply method
Applies this to project, with selection as it was when the command was
made.
Implementation
@override
Outcome apply(ModelProject project, ProjectSelection selection) {
if (materialIndex < 0 || materialIndex >= project.materials.length) {
return Outcome.refused('there is no material $materialIndex');
}
final ProjectMaterial material = project.materials[materialIndex];
return Outcome.done(
project.copyWith(
materials: <ProjectMaterial>[
for (var i = 0; i < project.materials.length; i++)
i == materialIndex
? material.withGraph(graph)
: project.materials[i],
],
),
);
}