clear method
Note: all elements below here should remain asynchronous to allow component tests to function properly. Clears the text of this element, if possible (e.g. for text fields).
focusBefore
indicates whether to focus this element before clearing.
blurAfter
indicates whether to blur this element after clearing.
Implementation
@override
Future<Null> clear({bool focusBefore = true, bool blurAfter = true}) async {
await syncFn(() async => _retryWhenStale(() async {
final element = _single;
if (_hasValueProperty(element)) {
if (focusBefore) await focus();
_setValue(element, '');
await _microtask(() => element.dispatchEvent(TextEvent('input')));
await _microtask(() => element.dispatchEvent(TextEvent('change')));
if (blurAfter) await blur();
} else {
throw PageLoaderException(
'${element.runtimeType} does not support clear.');
}
}));
}