Sync analyzer_options.yaml (flutter/engine#25129)

This commit is contained in:
Michael Goderbauer
2021-03-23 17:51:01 -07:00
committed by GitHub
parent 265a223709
commit 5d4faf7368
21 changed files with 155 additions and 84 deletions

View File

@@ -1,17 +1,19 @@
# Specify analysis options.
#
# This file is a copy of analysis_options_repo.yaml from flutter repo
# as of 2018-05-30, but with:
# This file is a copy of analysis_options.yaml from flutter repo
# as of 2021-03-19, but with:
# - "always_require_non_null_named_parameters" disabled (because we
# can't import the meta package from the SDK), and
# can't import the meta package from the SDK),
# - "avoid_equals_and_hash_code_on_mutable_classes" disabled (same reason),
# - "missing_whitespace_between_adjacent_strings" disabled (too many false
# positives),
# - "sort_constructors_first" disabled (because we have private fake
# constructors),
# - "prefer_final_fields" disabled (because we do weird things with
# private fields, especially on the PlatformDispatcher object):
# private fields, especially on the PlatformDispatcher object),
# - "public_member_api_docs" enabled.
analyzer:
enable-experiment:
- non-nullable
exclude: [
# this test pretends to be part of dart:ui and results in lots of false
# positives.
@@ -32,9 +34,8 @@ analyzer:
todo: ignore
# allow dart:ui to import dart:_internal
import_internal_library: ignore
# `flutter analyze` (without `--watch`) just ignores directories
# that contain a .dartignore file, and this file does not have any
# effect on what files are actually analyzed.
# Turned off until null-safe rollout is complete.
unnecessary_null_comparison: ignore
linter:
rules:
@@ -44,56 +45,89 @@ linter:
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
# always_require_non_null_named_parameters # DIFFERENT FROM FLUTTER/FLUTTER
# - always_require_non_null_named_parameters # DIFFERENT FROM FLUTTER/FLUTTER
- always_specify_types
# - always_use_package_imports # we do this commonly
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
# - avoid_as # required for implicit-casts: false
# - avoid_bool_literals_in_conditional_expressions # not yet tested
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catching_errors # we do this commonly
- avoid_classes_with_only_static_members # We want to avoid classes that can be instantiated but only have statics
# - avoid_double_and_int_checks # only useful when targeting JS runtime
# - avoid_dynamic_calls # not yet tested
- avoid_empty_else
# - avoid_equals_and_hash_code_on_mutable_classes # DIFFERENT FROM FLUTTER/FLUTTER
# - avoid_escaping_inner_quotes # not yet tested
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested
- avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
# - avoid_print # not yet tested
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
# - avoid_redundant_argument_values # not yet tested
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # we do this commonly
# - avoid_returning_this # https://github.com/dart-lang/linter/issues/842
# - avoid_returning_null # there are plenty of valid reasons to return null
# - avoid_returning_null_for_future # not yet tested
- avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested
# - avoid_single_cascade_in_expression_statements # not yet tested
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
# - avoid_types_as_parameter_names # https://github.com/dart-lang/linter/pull/954/files
- avoid_type_to_string
- avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
# - avoid_unused_constructor_parameters # https://github.com/dart-lang/linter/pull/847
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
# - avoid_web_libraries_in_flutter # not yet tested
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
# - cascade_invocations # not yet tested
# - close_sinks # https://github.com/flutter/flutter/issues/5789
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
- deprecated_consistency
# - diagnostic_describe_all_properties # not yet tested
- directives_ordering
# - do_not_use_environment # we do this commonly
- empty_catches
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not yet tested
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
# - lines_longer_than_80_chars # not required by flutter style
- list_remove_unrelated_type
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
# - missing_whitespace_between_adjacent_strings # DIFFERENT FROM FLUTTER/FLUTTER
- no_adjacent_strings_in_list
# - no_default_cases # too many false positives
- no_duplicate_case_values
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
- null_check_on_nullable_type_parameter
- null_closures
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
@@ -104,51 +138,88 @@ linter:
# - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
# - prefer_asserts_with_message # not required by flutter style
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # not yet tested
# - prefer_constructors_over_static_methods # far too many false positives
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
# - prefer_final_fields # DIFFERENT FROM FLUTTER/FLUTTER
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_inlined_adds
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
# - prefer_interpolation_to_compose_strings # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
- prefer_null_aware_operators
# - prefer_relative_imports # incompatible with sub-package imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- public_member_api_docs # this is the only difference from analysis_options.yaml
- prefer_void_to_null
- provide_deprecation_message
- public_member_api_docs # DIFFERENT FROM FLUTTER/FLUTTER
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
# - sort_child_properties_last # not yet tested
# - sort_constructors_first # DIFFERENT FROM FLUTTER/FLUTTER
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
# - unawaited_futures # too many false positives
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_new
- unnecessary_null_aware_assignments
# - unnecessary_null_checks # not yet tested
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
# - unnecessary_statements # not yet tested
# - unnecessary_raw_strings # not yet tested
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
# - unsafe_html # not yet tested
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
# - use_if_null_to_convert_nulls_to_bools # not yet tested
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
# - use_late_for_private_fields_and_variables # not yet tested
# - use_named_constants # not yet tested
- use_raw_strings
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps
- void_checks

View File

@@ -9,7 +9,7 @@ import 'dart:io';
import 'package:flutter_frontend_server/server.dart';
void main(List<String> args) async {
Future<void> main(List<String> args) async {
final int exitCode = await starter(args);
if (exitCode != 0) {
exit(exitCode);

View File

@@ -44,7 +44,7 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface {
}
@override
Future<Null> recompileDelta({String entryPoint}) async {
Future<Null> recompileDelta({String entryPoint}) async { // ignore: prefer_void_to_null
return _compiler.recompileDelta(entryPoint: entryPoint);
}
@@ -64,7 +64,7 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface {
}
@override
Future<Null> compileExpression(
Future<Null> compileExpression( // ignore: prefer_void_to_null
String expression,
List<String> definitions,
List<String> typeDefinitions,
@@ -76,7 +76,7 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface {
}
@override
Future<Null> compileExpressionToJs(
Future<Null> compileExpressionToJs( // ignore: prefer_void_to_null
String libraryUri,
int line,
int column,

View File

@@ -12,7 +12,7 @@ import 'package:path/path.dart' as path;
import 'package:test/test.dart';
void main(List<String> args) async {
Future<void> main(List<String> args) async {
if (args.length != 2) {
stderr.writeln('The first argument must be the path to the forntend server dill.');
stderr.writeln('The second argument must be the path to the flutter_patched_sdk');

View File

@@ -116,7 +116,7 @@ int hashValues(
int hashList(Iterable<Object?>? arguments) {
int result = 0;
if (arguments != null) {
for (Object? argument in arguments)
for (final Object? argument in arguments)
result = _Jenkins.combine(result, argument);
}
return _Jenkins.finish(result);

View File

@@ -78,7 +78,7 @@ List<int> saveCompilationTrace() {
dynamic _saveCompilationTrace() native 'SaveCompilationTrace';
void _scheduleMicrotask(void callback()) native 'ScheduleMicrotask';
void _scheduleMicrotask(void Function() callback) native 'ScheduleMicrotask';
int? _getCallbackHandle(Function closure) native 'GetCallbackHandle';
Function? _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle';

View File

@@ -1984,7 +1984,7 @@ class Codec extends NativeFieldWrapperClass2 {
if (error != null) {
throw Exception(error);
}
return await completer.future;
return completer.future;
}
/// Returns an error message on failure, null on success.
@@ -2699,7 +2699,7 @@ class PathMetricIterator implements Iterator<PathMetric> {
if (currentMetric == null) {
throw RangeError(
'PathMetricIterator is not pointing to a PathMetric. This can happen in two situations:\n'
'- The iteration has not started yet. If so, call "moveNext" to start iteration.'
'- The iteration has not started yet. If so, call "moveNext" to start iteration.\n'
'- The iterator ran out of elements. If so, check that "moveNext" returns true prior to calling "current".'
);
}

View File

@@ -358,7 +358,7 @@ class PlatformDispatcher {
void _dispatchKeyData(ByteData packet, int responseId) {
_invoke2<KeyData, _KeyDataResponseCallback>(
(KeyData data, _KeyDataResponseCallback callback) {
callback(responseId, onKeyData == null ? false : onKeyData!(data));
callback(responseId, onKeyData != null && onKeyData!(data));
},
_onKeyDataZone,
_unpackKeyData(packet),
@@ -644,7 +644,7 @@ class PlatformDispatcher {
/// platform specific APIs without invoking method channels.
Locale? computePlatformResolvedLocale(List<Locale> supportedLocales) {
final List<String?> supportedLocalesData = <String?>[];
for (Locale locale in supportedLocales) {
for (final Locale locale in supportedLocales) {
supportedLocalesData.add(locale.languageCode);
supportedLocalesData.add(locale.countryCode);
supportedLocalesData.add(locale.scriptCode);

View File

@@ -1497,7 +1497,7 @@ class TextDecoration {
/// Creates a decoration that paints the union of all the given decorations.
factory TextDecoration.combine(List<TextDecoration> decorations) {
int mask = 0;
for (TextDecoration decoration in decorations)
for (final TextDecoration decoration in decorations)
mask |= decoration._mask;
return TextDecoration._(mask);
}
@@ -3335,7 +3335,7 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
if (fontFeatures != null) {
encodedFontFeatures = ByteData(fontFeatures.length * FontFeature._kEncodedSize);
int byteOffset = 0;
for (FontFeature feature in fontFeatures) {
for (final FontFeature feature in fontFeatures) {
feature._encode(ByteData.view(encodedFontFeatures.buffer, byteOffset, FontFeature._kEncodedSize));
byteOffset += FontFeature._kEncodedSize;
}
@@ -3449,13 +3449,13 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
TextBaseline? baseline,
}) {
// Require a baseline to be specified if using a baseline-based alignment.
assert((alignment == PlaceholderAlignment.aboveBaseline ||
assert(!(alignment == PlaceholderAlignment.aboveBaseline ||
alignment == PlaceholderAlignment.belowBaseline ||
alignment == PlaceholderAlignment.baseline) ? baseline != null : true);
alignment == PlaceholderAlignment.baseline) || baseline != null);
// Default the baselineOffset to height if null. This will place the placeholder
// fully above the baseline, similar to [PlaceholderAlignment.aboveBaseline].
baselineOffset = baselineOffset ?? height;
_addPlaceholder(width * scale, height * scale, alignment.index, baselineOffset * scale, baseline == null ? null : baseline.index);
_addPlaceholder(width * scale, height * scale, alignment.index, baselineOffset * scale, baseline?.index);
_placeholderCount++;
_placeholderScales.add(scale);
}

View File

@@ -47,7 +47,7 @@ void testNoCrashes() {
final RRect rrect = RRect.fromRectAndCorners(rect);
const Offset offset = Offset(double.nan, double.nan);
final Path path = Path();
const Color color = Color(0);
const Color color = Color(0x00000000);
final Paragraph paragraph = ParagraphBuilder(ParagraphStyle()).build();
final PictureRecorder recorder = PictureRecorder();
@@ -151,7 +151,7 @@ Future<bool> fuzzyGoldenImageCompare(
final dart_image.Image png = dart_image.Image.fromBytes(
image.width, image.height, buffer.asUint8List());
final String outPath = path.join(imagesPath, 'found_' + goldenImageName);
File(outPath)..writeAsBytesSync(dart_image.encodePng(png));
File(outPath).writeAsBytesSync(dart_image.encodePng(png));
print('wrote: ' + outPath);
}
return areEqual;
@@ -226,7 +226,7 @@ void main() {
final Canvas canvas = Canvas(recorder);
const Rect rect = Rect.fromLTWH(0, 0, 100, 100);
final RSTransform transform = RSTransform(1, 0, 0, 0);
const Color color = Color(0);
const Color color = Color(0x00000000);
final Paint paint = Paint();
canvas.drawAtlas(image, <RSTransform>[transform], <Rect>[rect], <Color>[color], BlendMode.src, rect, paint);
canvas.drawAtlas(image, <RSTransform>[transform], <Rect>[rect], <Color>[color], BlendMode.src, null, paint);
@@ -249,7 +249,7 @@ void main() {
final Canvas canvas = Canvas(recorder);
const Rect rect = Rect.fromLTWH(0, 0, 100, 100);
final RSTransform transform = RSTransform(1, 0, 0, 0);
const Color color = Color(0);
const Color color = Color(0x00000000);
final Paint paint = Paint();
canvas.drawAtlas(image, <RSTransform>[transform], <Rect>[rect], <Color>[color], BlendMode.src, rect, paint);
canvas.drawAtlas(image, <RSTransform>[transform, transform], <Rect>[rect, rect], <Color>[color, color], BlendMode.src, rect, paint);

View File

@@ -29,9 +29,9 @@ void main() {
final ByteData data = _makeByteData('bar');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
bool called = false;
final ui.PlatformMessageResponseCallback callback = (ByteData responseData) {
void callback(ByteData responseData) {
called = true;
};
}
buffers.push(channel, data, callback);
await buffers.drain(channel, (ByteData drainedData, ui.PlatformMessageResponseCallback drainedCallback) {
expect(drainedData, equals(data));
@@ -46,7 +46,7 @@ void main() {
const String channel = 'foo';
final ByteData data = _makeByteData('message');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
final ui.PlatformMessageResponseCallback callback = (ByteData responseData) {};
void callback(ByteData responseData) {}
buffers.push(channel, data, callback);
final List<String> log = <String>[];
final Completer<void> completer = Completer<void>();
@@ -73,7 +73,7 @@ void main() {
final ByteData data = _makeByteData('bar');
final
ui.ChannelBuffers buffers = ui.ChannelBuffers();
final ui.PlatformMessageResponseCallback callback = (ByteData responseData) {};
void callback(ByteData responseData) {}
_resize(buffers, channel, 0);
buffers.push(channel, data, callback);
bool didCall = false;
@@ -102,7 +102,7 @@ void main() {
final ByteData three = _makeByteData('three');
final ByteData four = _makeByteData('four');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
final ui.PlatformMessageResponseCallback callback = (ByteData responseData) {};
void callback(ByteData responseData) {}
_resize(buffers, channel, 3);
buffers.push(channel, one, callback);
buffers.push(channel, two, callback);
@@ -133,7 +133,7 @@ void main() {
final ByteData two = _makeByteData('two');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
_resize(buffers, channel, 100);
final ui.PlatformMessageResponseCallback callback = (ByteData responseData) {};
void callback(ByteData responseData) {}
buffers.push(channel, one, callback);
buffers.push(channel, two, callback);
_resize(buffers, channel, 1);
@@ -155,13 +155,13 @@ void main() {
final ByteData two = _makeByteData('two');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
bool didCallCallback = false;
final ui.PlatformMessageResponseCallback oneCallback = (ByteData responseData) {
void oneCallback(ByteData responseData) {
expect(responseData, isNull);
didCallCallback = true;
};
final ui.PlatformMessageResponseCallback twoCallback = (ByteData responseData) {
}
void twoCallback(ByteData responseData) {
throw TestFailure('wrong callback called');
};
}
_resize(buffers, channel, 100);
buffers.push(channel, one, oneCallback);
buffers.push(channel, two, twoCallback);
@@ -176,13 +176,13 @@ void main() {
final ByteData two = _makeByteData('two');
final ui.ChannelBuffers buffers = ui.ChannelBuffers();
bool didCallCallback = false;
final ui.PlatformMessageResponseCallback oneCallback = (ByteData responseData) {
void oneCallback(ByteData responseData) {
expect(responseData, isNull);
didCallCallback = true;
};
final ui.PlatformMessageResponseCallback twoCallback = (ByteData responseData) {
}
void twoCallback(ByteData responseData) {
throw TestFailure('wrong callback called');
};
}
_resize(buffers, channel, 1);
buffers.push(channel, one, oneCallback);
buffers.push(channel, two, twoCallback);

View File

@@ -48,12 +48,12 @@ void main() {
});
test('two colors are only == if they have the same runtime type', () {
expect(const Color(123), equals(const Color(123)));
expect(const Color(123), equals(Color(123))); // ignore: prefer_const_constructors
expect(const Color(123), isNot(equals(const Color(321))));
expect(const Color(123), isNot(equals(const NotAColor(123))));
expect(const NotAColor(123), isNot(equals(const Color(123))));
expect(const NotAColor(123), equals(const NotAColor(123)));
expect(const Color(0x12345678), equals(const Color(0x12345678)));
expect(const Color(0x12345678), equals(Color(0x12345678))); // ignore: prefer_const_constructors
expect(const Color(0x12345678), isNot(equals(const Color(0x87654321))));
expect(const Color(0x12345678), isNot(equals(const NotAColor(0x12345678))));
expect(const NotAColor(0x12345678), isNot(equals(const Color(0x12345678))));
expect(const NotAColor(0x12345678), equals(const NotAColor(0x12345678)));
});
test('Color.lerp', () {

View File

@@ -84,7 +84,7 @@ class Square4x4Image {
canvas.drawRect(Rect.fromLTWH(0.0, 0.0, width, width), black);
canvas.drawRect(
Rect.fromLTWH(radius, radius, innerWidth, innerWidth), green);
return await recorder.endRecording().toImage(_kWidth, _kWidth);
return recorder.endRecording().toImage(_kWidth, _kWidth);
}
static List<int> get bytes {
@@ -118,7 +118,7 @@ class GrayscaleImage {
final Uint8List bytes = await readFile('2x2.png');
final Completer<Image> completer = Completer<Image>();
decodeImageFromList(bytes, (Image image) => completer.complete(image));
return await completer.future;
return completer.future;
}
static List<int> get bytesAsRgba {
@@ -135,5 +135,5 @@ class GrayscaleImage {
Future<Uint8List> readFile(String fileName) async {
final File file = File(path.join('flutter', 'testing', 'resources', fileName));
return await file.readAsBytes();
return file.readAsBytes();
}

View File

@@ -88,7 +88,7 @@ void main() {
Future<Uint8List> readFile(String fileName, ) async {
final File file =
File(path.join('flutter', 'testing', 'resources', fileName));
return await file.readAsBytes();
return file.readAsBytes();
}
/// Returns a File handle to a file in the skia/resources directory.

View File

@@ -154,5 +154,5 @@ Future<Uint8List> readFile(String fileName) async {
'resources',
fileName,
));
return await file.readAsBytes();
return file.readAsBytes();
}

View File

@@ -196,7 +196,7 @@ class BlackSquare {
targetWidth: targetWidth,
allowUpscaling: allowUpscaling,
);
return await imageCompleter.future;
return imageCompleter.future;
}
final int width;
@@ -207,5 +207,5 @@ class BlackSquare {
Future<Uint8List> readFile(String fileName) async {
final File file =
File(path.join('flutter', 'testing', 'resources', fileName));
return await file.readAsBytes();
return file.readAsBytes();
}

View File

@@ -10,6 +10,6 @@ import 'package:test/test.dart';
void main() {
test('Invalid isolate URI', () async {
final Future<Isolate> isolate = Isolate.spawnUri(Uri.parse('http://127.0.0.1/foo.dart'), <String>[], null);
expect(() async => await isolate, throwsA(const TypeMatcher<IsolateSpawnException>()));
expect(() async => isolate, throwsA(const TypeMatcher<IsolateSpawnException>()));
});
}

View File

@@ -9,7 +9,7 @@ import 'package:test/test.dart';
void main() {
test('Locale', () {
const Null $null = null;
const Null $null = null; // ignore: prefer_void_to_null
expect(const Locale('en').toLanguageTag(), 'en');
expect(const Locale('en'), const Locale('en', $null));
expect(const Locale('en').hashCode, const Locale('en', $null).hashCode);

View File

@@ -12,7 +12,7 @@ void main() {
const double kAhemBaselineRatio = 1.25;
test('predictably lays out a single-line paragraph', () {
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
fontFamily: 'Ahem',
fontStyle: FontStyle.normal,
@@ -36,7 +36,7 @@ void main() {
});
test('predictably lays out a multi-line paragraph', () {
for (double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
for (final double fontSize in <double>[10.0, 20.0, 30.0, 40.0]) {
final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle(
fontFamily: 'Ahem',
fontStyle: FontStyle.normal,

View File

@@ -42,7 +42,7 @@ void main() {
expect(PluginUtilities.getCallbackHandle(foo.getDouble), isNull);
// Anonymous closures cannot be looked up.
final Function anon = (int a, int b) => a + b;
final Function anon = (int a, int b) => a + b; // ignore: prefer_function_declarations_over_variables
expect(PluginUtilities.getCallbackHandle(anon), isNull);
});
}

View File

@@ -63,7 +63,7 @@ class PoppableScreenScenario extends Scenario with PlatformEchoMixin {
@override
void onPointerDataPacket(PointerDataPacket packet) {
for (PointerData data in packet.data) {
for (final PointerData data in packet.data) {
if (data.change == PointerChange.up &&
_buttonRect?.contains(Offset(data.physicalX, data.physicalY)) == true
) {