persistAutoLoad method

  1. @override
void persistAutoLoad({
  1. int? slot,
})
inherited

Implementation

@override
void persistAutoLoad({
  int? slot,
}) {
  if (_savedSnapshots.isEmpty) return;

  final _TimestampedSnapshot<T, E, S> target;

  if (slot != null) {
    final String key = _getAutoSlotKey(slot);
    final found = _savedSnapshots[key];
    if (found == null) return;
    target = found;
  } else {
    target = _savedSnapshots.values.reduce(
      (a, b) => a.simTime >= b.simTime ? a : b,
    );
  }

  restoreSnapshot(target.snapshot);
}