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
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
tourhas been finished before.override -
lastIndex(
String tour) → Future< int?> -
The step
tourhad reached when the app last stopped, if it was recorded.override -
markCompleted(
String tour) → Future< void> -
Records
touras finished.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
String tour) → Future< void> -
Forgets that
tourwas finished, so it can run again.override -
saveIndex(
String tour, int? index) → Future< void> -
Records that
touris on stepindex, or forgets the position whenindexis null.override -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited