setSketch method
Can be used to update the state of the Sketch externally (e.g. when
fetching from a server) to what is passed in as sketch
;
Per default, this state of the sketch gets added to the undo history. If
this is not desired, set addToUndoHistory
to false
.
Implementation
void setSketch({required Sketch sketch, bool addToUndoHistory = true}) {
final newState = value.copyWith(
sketch: sketch,
);
if (addToUndoHistory) {
value = newState;
} else {
temporaryValue = newState;
}
}