TestDriverDefaultValue<T> class

Use this annotation on properties/methods 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 = ...;
    Localization _localization = ...;

    @TestDriverDefaultValue(123)
    int get randomNumber => _randomNumberService.theRandomNumber;

    @TestDriverDefaultValue('Get new random number')
    String get buttonText => _localization.getRandomNumberButtonText;

    @TestDriverDefaultValue()
    void updateRandomNumber() {
        ...
    }
}

This will generate the following TestDriver

class _$RandomNumberWidgetDriver extends TestDriver implements CoffeeLibraryPageDriver {
    @override
    int get randomNumber => 123;

    @override
    String get buttonText => 'Get new random number';

    @override
    void updateRandomNumber() {}
}

Constructors

TestDriverDefaultValue([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