Enable use_function_type_syntax_for_parameters lint (#77163)
This commit is contained in:
committed by
GitHub
parent
8f9c6af2dd
commit
7b251f5f37
@@ -402,7 +402,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
/// current timeout, if any. See [AutomatedTestWidgetsFlutterBinding.addTime]
|
||||
/// for details.
|
||||
Future<T?> runAsync<T>(
|
||||
Future<T> callback(), {
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
});
|
||||
|
||||
@@ -600,7 +600,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
///
|
||||
/// The `timeout` argument sets the initial timeout, if any. It can
|
||||
/// be increased with [addTime]. By default there is no timeout.
|
||||
Future<void> runTest(Future<void> testBody(), VoidCallback invariantTester, { String description = '', Duration? timeout });
|
||||
Future<void> runTest(Future<void> Function() testBody, VoidCallback invariantTester, { String description = '', Duration? timeout });
|
||||
|
||||
/// This is called during test execution before and after the body has been
|
||||
/// executed.
|
||||
@@ -641,7 +641,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
}
|
||||
|
||||
Future<void> _runTest(
|
||||
Future<void> testBody(),
|
||||
Future<void> Function() testBody,
|
||||
VoidCallback invariantTester,
|
||||
String description, {
|
||||
Future<void>? timeout,
|
||||
@@ -774,7 +774,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
return testCompleter.future;
|
||||
}
|
||||
|
||||
Future<void> _runTestBody(Future<void> testBody(), VoidCallback invariantTester) async {
|
||||
Future<void> _runTestBody(Future<void> Function() testBody, VoidCallback invariantTester) async {
|
||||
assert(inTest);
|
||||
// So that we can assert that it remains the same after the test finishes.
|
||||
_beforeTestCheckIntrinsicSizes = debugCheckIntrinsicSizes;
|
||||
@@ -979,7 +979,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
|
||||
@override
|
||||
Future<T?> runAsync<T>(
|
||||
Future<T> callback(), {
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
}) {
|
||||
assert(additionalTime != null);
|
||||
@@ -996,13 +996,13 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
|
||||
final Zone realAsyncZone = Zone.current.fork(
|
||||
specification: ZoneSpecification(
|
||||
scheduleMicrotask: (Zone self, ZoneDelegate parent, Zone zone, void f()) {
|
||||
scheduleMicrotask: (Zone self, ZoneDelegate parent, Zone zone, void Function() f) {
|
||||
Zone.root.scheduleMicrotask(f);
|
||||
},
|
||||
createTimer: (Zone self, ZoneDelegate parent, Zone zone, Duration duration, void f()) {
|
||||
createTimer: (Zone self, ZoneDelegate parent, Zone zone, Duration duration, void Function() f) {
|
||||
return Zone.root.createTimer(duration, f);
|
||||
},
|
||||
createPeriodicTimer: (Zone self, ZoneDelegate parent, Zone zone, Duration period, void f(Timer timer)) {
|
||||
createPeriodicTimer: (Zone self, ZoneDelegate parent, Zone zone, Duration period, void Function(Timer timer) f) {
|
||||
return Zone.root.createPeriodicTimer(period, f);
|
||||
},
|
||||
),
|
||||
@@ -1166,7 +1166,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
|
||||
@override
|
||||
Future<void> runTest(
|
||||
Future<void> testBody(),
|
||||
Future<void> Function() testBody,
|
||||
VoidCallback invariantTester, {
|
||||
String description = '',
|
||||
Duration? timeout,
|
||||
@@ -1582,7 +1582,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
|
||||
@override
|
||||
Future<T?> runAsync<T>(
|
||||
Future<T> callback(), {
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
}) async {
|
||||
assert(() {
|
||||
@@ -1615,7 +1615,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> runTest(Future<void> testBody(), VoidCallback invariantTester, { String description = '', Duration? timeout }) async {
|
||||
Future<void> runTest(Future<void> Function() testBody, VoidCallback invariantTester, { String description = '', Duration? timeout }) async {
|
||||
assert(description != null);
|
||||
assert(!inTest);
|
||||
_inTest = true;
|
||||
|
||||
@@ -890,7 +890,7 @@ abstract class WidgetController {
|
||||
/// in the documentation for the [flutter_test] library.
|
||||
static bool hitTestWarningShouldBeFatal = false;
|
||||
|
||||
Offset _getElementPoint(Finder finder, Offset sizeToPoint(Size size), { required bool warnIfMissed, required String callee }) {
|
||||
Offset _getElementPoint(Finder finder, Offset Function(Size size) sizeToPoint, { required bool warnIfMissed, required String callee }) {
|
||||
TestAsyncUtils.guardSync();
|
||||
final Iterable<Element> elements = finder.evaluate();
|
||||
if (elements.isEmpty) {
|
||||
|
||||
@@ -685,7 +685,7 @@ class _FindsWidgetMatcher extends Matcher {
|
||||
}
|
||||
}
|
||||
|
||||
bool _hasAncestorMatching(Finder finder, bool predicate(Widget widget)) {
|
||||
bool _hasAncestorMatching(Finder finder, bool Function(Widget widget) predicate) {
|
||||
final Iterable<Element> nodes = finder.evaluate();
|
||||
if (nodes.length != 1)
|
||||
return false;
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestAsyncUtils {
|
||||
/// this one before this one has finished will throw an exception.
|
||||
///
|
||||
/// This method first calls [guardSync].
|
||||
static Future<T> guard<T>(Future<T> body()) {
|
||||
static Future<T> guard<T>(Future<T> Function() body) {
|
||||
guardSync();
|
||||
final Zone zone = Zone.current.fork(
|
||||
zoneValues: <dynamic, dynamic>{
|
||||
|
||||
@@ -746,7 +746,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
|
||||
/// * Expose a [Future] in your application code that signals the readiness of
|
||||
/// your widget tree, then await that future inside [callback].
|
||||
Future<T?> runAsync<T>(
|
||||
Future<T> callback(), {
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
}) => binding.runAsync<T?>(callback, additionalTime: additionalTime);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
|
||||
reportTestException = (FlutterErrorDetails details, String testDescription) {
|
||||
expect(details.exception, isA<StateError>());
|
||||
expect((details.exception as StateError).message, 'foo');
|
||||
|
||||
@@ -52,7 +52,7 @@ void main() {
|
||||
return path.replaceAll('/', fs.path.separator);
|
||||
}
|
||||
|
||||
void test(String description, FutureOr<void> body()) {
|
||||
void test(String description, FutureOr<void> Function() body) {
|
||||
test_package.test(description, () async {
|
||||
await io.IOOverrides.runZoned<FutureOr<void>>(
|
||||
body,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
|
||||
await runZoned<dynamic>(testMain, zoneValues: <Type, String>{
|
||||
String: '/test_config',
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
Future<void> testExecutable(FutureOr<void> testMain()) async {
|
||||
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
|
||||
await runZoned<dynamic>(testMain, zoneValues: <Type, dynamic>{
|
||||
String: '/test_config/nested_config',
|
||||
int: 123,
|
||||
|
||||
Reference in New Issue
Block a user