enable prefer_function_declarations_over_variables lint (#77398)

This commit is contained in:
Michael Goderbauer
2021-03-05 18:29:04 -08:00
committed by GitHub
parent 3571882e43
commit 807bb29888
70 changed files with 274 additions and 276 deletions

View File

@@ -5,7 +5,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
@@ -21,9 +20,9 @@ void main() {
await tester.pumpAndSettle();
final Offset location = tester.getCenter(find.byType(ListView));
int frameCount = 0;
final FrameCallback frameCounter = (Duration elapsed) {
void frameCounter(Duration elapsed) {
frameCount += 1;
};
}
tester.binding.addPersistentFrameCallback(frameCounter);
const int timeInSecond = 1;

View File

@@ -77,7 +77,7 @@ Future<void> main() async {
Directory(path.join(hostAppDir.path, 'gradle', 'wrapper')),
);
final Function clean = () async {
Future<void> clean() async {
section('Clean');
await inDirectory(hostAppDir, () async {
await exec(gradlewExecutable,
@@ -87,7 +87,7 @@ Future<void> main() async {
},
);
});
};
}
if (!Platform.isWindows) {
section('Make $gradlewExecutable executable');

View File

@@ -179,7 +179,6 @@ class FakeDevice extends AndroidDevice {
FakeDevice({String deviceId}) : super(deviceId: deviceId);
static String output = '';
static ExitErrorFactory exitErrorFactory = () => null;
static List<CommandArgs> commandLog = <CommandArgs>[];
@@ -222,8 +221,5 @@ class FakeDevice extends AndroidDevice {
arguments: arguments,
environment: environment,
));
final dynamic exitError = exitErrorFactory();
if (exitError != null)
throw exitError;
}
}

View File

@@ -4,7 +4,7 @@
import 'localizations_utils.dart';
HeaderGenerator generateCupertinoHeader = (String regenerateInstructions) {
String generateCupertinoHeader(String regenerateInstructions) {
return '''
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -27,11 +27,11 @@ import '../cupertino_localizations.dart';
// These classes are constructed by the [getCupertinoTranslation] method at the
// bottom of this file, and used by the [_GlobalCupertinoLocalizationsDelegate.load]
// method defined in `flutter_localizations/lib/src/cupertino_localizations.dart`.''';
};
}
/// Returns the source of the constructor for a GlobalCupertinoLocalizations
/// subclass.
ConstructorGenerator generateCupertinoConstructor = (LocaleInfo locale) {
String generateCupertinoConstructor(LocaleInfo locale) {
final String localeName = locale.originalString;
return '''
/// Create an instance of the translation bundle for ${describeLocale(localeName)}.
@@ -58,7 +58,7 @@ ConstructorGenerator generateCupertinoConstructor = (LocaleInfo locale) {
singleDigitSecondFormat: singleDigitSecondFormat,
decimalFormat: decimalFormat,
);''';
};
}
const String cupertinoFactoryName = 'getCupertinoTranslation';

View File

@@ -4,7 +4,7 @@
import 'localizations_utils.dart';
HeaderGenerator generateMaterialHeader = (String regenerateInstructions) {
String generateMaterialHeader(String regenerateInstructions) {
return '''
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -27,11 +27,11 @@ import '../material_localizations.dart';
// These classes are constructed by the [getMaterialTranslation] method at the
// bottom of this file, and used by the [_MaterialLocalizationsDelegate.load]
// method defined in `flutter_localizations/lib/src/material_localizations.dart`.''';
};
}
/// Returns the source of the constructor for a GlobalMaterialLocalizations
/// subclass.
ConstructorGenerator generateMaterialConstructor = (LocaleInfo locale) {
String generateMaterialConstructor(LocaleInfo locale) {
final String localeName = locale.originalString;
return '''
/// Create an instance of the translation bundle for ${describeLocale(localeName)}.
@@ -60,7 +60,7 @@ ConstructorGenerator generateMaterialConstructor = (LocaleInfo locale) {
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
);''';
};
}
const String materialFactoryName = 'getMaterialTranslation';