copyWith method
Copy the state
Implementation
SnapState<T> copyWith({
StateStatus? status,
T? data,
SnapError? error,
String? infoMessage,
String? debugName,
SnapState<T>? oldSnapState,
bool? isImmutable,
}) {
final s = SnapState<T>._(
status: status ?? this.status,
data: isImmutable == true ? data : data ?? this.data,
snapError: error ??
(status == null || status == StateStatus.isWaiting
? this.snapError
: null),
oldSnapState: (status != null || data != null || error != null)
? oldSnapState ?? this
: this.oldSnapState,
debugName: debugName ?? _debugName,
toDebugString: _toDebugString,
infoMessage: infoMessage ?? _infoMessage,
isImmutable: isImmutable ?? _isImmutable,
);
// assert(_infoMessage == kRefreshMessage ||
// infoMessage == kRefreshMessage ||
// infoMessage == kDisposeMessage ||
// _infoMessage == kInitMessage ||
// s.status != s.oldSnapState?.status ||
// s != s.oldSnapState);
return s;
}