TestDriverDefaultFutureValue<T> class
Use this annotation on properties/methods which return Futures
in your
Driver
to generate the hardcoded default test values which will be used
by the TestDriver
. Your DrivableWidget
will then use these values from
the TestDriver
when it is created during testing.
Here is an example of how to use these:
@GenerateTestDriver()
class RandomNumberWidgetDriver extends WidgetDriver {
RandomNumberService _randomNumberService = ...;
@TestDriverDefaultFutureValue(123)
Future<int> get randomNumber => _randomNumberService.theRandomNumberFuture;
@TestDriverDefaultFutureValue(false)
Future<bool> updateRandomNumber() {
...
}
}
This will generate the following TestDriver
class _$RandomNumberWidgetDriver extends TestDriver implements CoffeeLibraryPageDriver {
@override
Future<int> get randomNumber => Future.value(123);
@override
Future<bool> updateRandomNumber() {
return Future.value(false);
}
}
Constructors
- TestDriverDefaultFutureValue([T? value])
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T?
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited