saveIndex method

  1. @override
Future<void> saveIndex(
  1. String tour,
  2. int? index
)
override

Records that tour is on step index, or forgets the position when index is null.

Called on every step change and once more when the tour ends, so a finished tour does not resume in the middle next time. The default does nothing, which is what makes resuming opt-in per storage.

Implementation

@override
Future<void> saveIndex(String tour, int? index) async {
  calls.add('saveIndex:$tour:$index');
  if (index == null) {
    indices.remove(tour);
  } else {
    indices[tour] = index;
  }
}