FakeTourStorage class

A TourStorage with the state a test wants to arrange up front.

Saves you writing the same five-line fake in every suite:

final storage = FakeTourStorage(completed: <String>{'onboarding'});
// ... the tour does not start, because it is already done.

final resumable = FakeTourStorage(indices: <String, int>{'onboarding': 2});
await controller.start('onboarding', resume: true);
expect(controller.index, 2);

Every call is recorded in calls, in order, so a test can assert that storage was consulted rather than only what it answered.

Implemented types

Constructors

FakeTourStorage({Set<String>? completed, Map<String, int>? indices})
Creates a storage pre-loaded with completed tours and indices.

Properties

calls List<String>
Every call made to this storage, as 'method:argument' strings.
final
completed Set<String>
The tours currently recorded as finished.
final
hashCode int
The hash code for this object.
no setterinherited
indices Map<String, int>
The saved step index per tour, for start(resume: true).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

isCompleted(String tour) Future<bool>
Whether tour has been finished before.
override
lastIndex(String tour) Future<int?>
The step tour had reached when the app last stopped, if it was recorded.
override
markCompleted(String tour) Future<void>
Records tour as finished.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset(String tour) Future<void>
Forgets that tour was finished, so it can run again.
override
saveIndex(String tour, int? index) Future<void>
Records that tour is on step index, or forgets the position when index is null.
override
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited