reset method
Reset the model of this controller.
The implementation of init()
is used.
UPDATE: You can now optionally clear the
state history with clearHistory
parameter.
Please note that it would also reset your
undo/redo state.
Implementation
void reset({bool? clearHistory}) {
if (clearHistory ?? false) {
_momentumModelHistory!.clear();
_currentActiveModel = init();
_momentumModelHistory!.add(_currentActiveModel!);
_initialMomentumModel = _momentumModelHistory![0];
_latestMomentumModel = _momentumModelHistory![0];
_nextModel = null;
_prevModel = null;
_setMomentum(null, backward: true);
} else {
_currentActiveModel = init();
_setMomentum(init());
}
if (_momentumLogging!) {
print(_formatMomentumLog('[$this] has been reset.'));
}
}