Implementation
@override
Object? Function() get mockableCreator {
final creator = super.mockableCreator;
if (cachedCreatorMocks.last != null) {
return creator;
}
if (undoRedoPersistState?.persistanceProvider != null) {
final val = _snapState._infoMessage == kInitMessage
? undoRedoPersistState!.persistedCreator()
: null;
Object? Function() recreate(T? val) {
final shouldRecreate =
undoRedoPersistState!.persistanceProvider!.shouldRecreateTheState;
if (shouldRecreate == true ||
(shouldRecreate == null && creator is Stream Function())) {
if (val != null) {
// See issue 192
initialState = val;
shouldRecreateTheValue = val;
}
return creator;
}
return val != null ? () => val : creator;
}
if (val is Future) {
return () async {
final r = await val;
return recreate(r)();
};
}
return recreate(val);
}
return creator;
}