Unverified Commit 2bab6514 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Enable `avoid_implementing_value_types` lint (#91078)

parent 7b8a3c1b
...@@ -32,10 +32,6 @@ analyzer: ...@@ -32,10 +32,6 @@ analyzer:
# allow self-reference to deprecated members (we do this because otherwise we have # allow self-reference to deprecated members (we do this because otherwise we have
# to annotate every member in every test, assert, etc, when we deprecate something) # to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore deprecated_member_use_from_same_package: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
# TODO(https://github.com/flutter/flutter/issues/74381): # TODO(https://github.com/flutter/flutter/issues/74381):
# Clean up existing unnecessary imports, and remove line to ignore. # Clean up existing unnecessary imports, and remove line to ignore.
unnecessary_import: ignore unnecessary_import: ignore
...@@ -70,7 +66,7 @@ linter: ...@@ -70,7 +66,7 @@ linter:
- avoid_escaping_inner_quotes - avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes - avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls - avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested - avoid_implementing_value_types
- avoid_init_to_null - avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime # - avoid_js_rounded_ints # only useful when targeting JS runtime
- avoid_null_checks_in_equality_operators - avoid_null_checks_in_equality_operators
......
...@@ -21,6 +21,11 @@ import 'framework.dart'; ...@@ -21,6 +21,11 @@ import 'framework.dart';
/// than [Widget] as the type of their `child` property. /// than [Widget] as the type of their `child` property.
/// ///
/// Use [PreferredSize] to give a preferred size to an arbitrary widget. /// Use [PreferredSize] to give a preferred size to an arbitrary widget.
// (We ignore `avoid_implementing_value_types` here because the superclass
// doesn't really implement `operator ==`, it just overrides it to _prevent_ it
// from being implemented, which is the exact opposite of the spirit of the
// `avoid_implementing_value_types` lint.)
// ignore: avoid_implementing_value_types
abstract class PreferredSizeWidget implements Widget { abstract class PreferredSizeWidget implements Widget {
/// The size this widget would prefer if it were otherwise unconstrained. /// The size this widget would prefer if it were otherwise unconstrained.
/// ///
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -461,7 +460,7 @@ void main() { ...@@ -461,7 +460,7 @@ void main() {
expect(dependentBuildCount, equals(4)); expect(dependentBuildCount, equals(4));
// didChangeAccessibilityFeatures // didChangeAccessibilityFeatures
tester.binding.window.accessibilityFeaturesTestValue = MockAccessibilityFeature(); tester.binding.window.accessibilityFeaturesTestValue = FakeAccessibilityFeatures.allOn;
addTearDown(tester.binding.window.clearAccessibilityFeaturesTestValue); addTearDown(tester.binding.window.clearAccessibilityFeaturesTestValue);
await tester.pump(); await tester.pump();
...@@ -768,7 +767,7 @@ void main() { ...@@ -768,7 +767,7 @@ void main() {
testWidgets('MaterialApp uses high contrast theme when appropriate', (WidgetTester tester) async { testWidgets('MaterialApp uses high contrast theme when appropriate', (WidgetTester tester) async {
tester.binding.window.platformBrightnessTestValue = Brightness.light; tester.binding.window.platformBrightnessTestValue = Brightness.light;
tester.binding.window.accessibilityFeaturesTestValue = MockAccessibilityFeature(); tester.binding.window.accessibilityFeaturesTestValue = FakeAccessibilityFeatures.allOn;
late ThemeData appliedTheme; late ThemeData appliedTheme;
...@@ -795,7 +794,7 @@ void main() { ...@@ -795,7 +794,7 @@ void main() {
testWidgets('MaterialApp uses high contrast dark theme when appropriate', (WidgetTester tester) async { testWidgets('MaterialApp uses high contrast dark theme when appropriate', (WidgetTester tester) async {
tester.binding.window.platformBrightnessTestValue = Brightness.dark; tester.binding.window.platformBrightnessTestValue = Brightness.dark;
tester.binding.window.accessibilityFeaturesTestValue = MockAccessibilityFeature(); tester.binding.window.accessibilityFeaturesTestValue = FakeAccessibilityFeatures.allOn;
late ThemeData appliedTheme; late ThemeData appliedTheme;
...@@ -828,7 +827,7 @@ void main() { ...@@ -828,7 +827,7 @@ void main() {
testWidgets('MaterialApp uses dark theme when no high contrast dark theme is provided', (WidgetTester tester) async { testWidgets('MaterialApp uses dark theme when no high contrast dark theme is provided', (WidgetTester tester) async {
tester.binding.window.platformBrightnessTestValue = Brightness.dark; tester.binding.window.platformBrightnessTestValue = Brightness.dark;
tester.binding.window.accessibilityFeaturesTestValue = MockAccessibilityFeature(); tester.binding.window.accessibilityFeaturesTestValue = FakeAccessibilityFeatures.allOn;
late ThemeData appliedTheme; late ThemeData appliedTheme;
...@@ -1173,26 +1172,6 @@ class MockScrollBehavior extends ScrollBehavior { ...@@ -1173,26 +1172,6 @@ class MockScrollBehavior extends ScrollBehavior {
ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics(); ScrollPhysics getScrollPhysics(BuildContext context) => const NeverScrollableScrollPhysics();
} }
class MockAccessibilityFeature implements AccessibilityFeatures {
@override
bool get accessibleNavigation => true;
@override
bool get boldText => true;
@override
bool get disableAnimations => true;
@override
bool get highContrast => true;
@override
bool get invertColors => true;
@override
bool get reduceMotion => true;
}
typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation); typedef SimpleRouterDelegateBuilder = Widget Function(BuildContext, RouteInformation);
typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate); typedef SimpleNavigatorRouterDelegatePopPage<T> = bool Function(Route<T> route, T result, SimpleNavigatorRouterDelegate delegate);
......
...@@ -694,6 +694,7 @@ class _TestState extends State<Test> { ...@@ -694,6 +694,7 @@ class _TestState extends State<Test> {
/// This class exists only to make sure that we test all the properties of the /// This class exists only to make sure that we test all the properties of the
/// [TextStyle] class. If a property is added/removed/renamed, the analyzer will /// [TextStyle] class. If a property is added/removed/renamed, the analyzer will
/// complain that this class has incorrect overrides. /// complain that this class has incorrect overrides.
// ignore: avoid_implementing_value_types
class _TextStyleProxy implements TextStyle { class _TextStyleProxy implements TextStyle {
_TextStyleProxy(this._delegate); _TextStyleProxy(this._delegate);
......
...@@ -43,8 +43,3 @@ class TestImageProvider extends ImageProvider<TestImageProvider> { ...@@ -43,8 +43,3 @@ class TestImageProvider extends ImageProvider<TestImageProvider> {
@override @override
String toString() => '${describeIdentity(this)}()'; String toString() => '${describeIdentity(this)}()';
} }
class FakeImageConfiguration implements ImageConfiguration {
@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
...@@ -8,17 +8,12 @@ import 'dart:ui' as ui show Image; ...@@ -8,17 +8,12 @@ import 'dart:ui' as ui show Image;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
class TestImageInfo implements ImageInfo { class TestImageInfo extends ImageInfo {
const TestImageInfo(this.value, { required this.image, this.scale = 1.0, this.debugLabel }); const TestImageInfo(this.value, {
required ui.Image image,
@override double scale = 1.0,
final ui.Image image; String? debugLabel,
}) : super(image: image, scale: scale, debugLabel: debugLabel);
@override
final double scale;
@override
final String? debugLabel;
final int value; final int value;
...@@ -30,22 +25,6 @@ class TestImageInfo implements ImageInfo { ...@@ -30,22 +25,6 @@ class TestImageInfo implements ImageInfo {
return TestImageInfo(value, image: image.clone(), scale: scale, debugLabel: debugLabel); return TestImageInfo(value, image: image.clone(), scale: scale, debugLabel: debugLabel);
} }
@override
bool isCloneOf(ImageInfo other) {
assert(other != null);
return other.image.isCloneOf(image)
&& scale == scale
&& other.debugLabel == debugLabel;
}
@override
void dispose() {
image.dispose();
}
@override
int get sizeBytes => image.height * image.width * 4;
@override @override
int get hashCode => hashValues(value, image, scale, debugLabel); int get hashCode => hashValues(value, image, scale, debugLabel);
...@@ -58,7 +37,6 @@ class TestImageInfo implements ImageInfo { ...@@ -58,7 +37,6 @@ class TestImageInfo implements ImageInfo {
&& other.image.isCloneOf(image) && other.image.isCloneOf(image)
&& other.scale == scale && other.scale == scale
&& other.debugLabel == debugLabel; && other.debugLabel == debugLabel;
} }
} }
......
...@@ -158,7 +158,7 @@ Future<void> main() async { ...@@ -158,7 +158,7 @@ Future<void> main() async {
testWidgets('shows a cached image immediately when skipFadeOnSynchronousLoad=true', (WidgetTester tester) async { testWidgets('shows a cached image immediately when skipFadeOnSynchronousLoad=true', (WidgetTester tester) async {
final TestImageProvider placeholderProvider = TestImageProvider(placeholderImage); final TestImageProvider placeholderProvider = TestImageProvider(placeholderImage);
final TestImageProvider imageProvider = TestImageProvider(targetImage); final TestImageProvider imageProvider = TestImageProvider(targetImage);
imageProvider.resolve(FakeImageConfiguration()); imageProvider.resolve(ImageConfiguration.empty);
imageProvider.complete(); imageProvider.complete();
await tester.pumpWidget(FadeInImage( await tester.pumpWidget(FadeInImage(
......
...@@ -33,12 +33,12 @@ void main() { ...@@ -33,12 +33,12 @@ void main() {
group('VMServiceFlutterDriver with logCommunicationToFile', () { group('VMServiceFlutterDriver with logCommunicationToFile', () {
late FakeVmService fakeClient; late FakeVmService fakeClient;
late FakeVM fakeVM; late FakeVM fakeVM;
late FakeIsolate fakeIsolate; late vms.Isolate fakeIsolate;
late VMServiceFlutterDriver driver; late VMServiceFlutterDriver driver;
late File logFile; late File logFile;
setUp(() { setUp(() {
fakeIsolate = FakeIsolate(); fakeIsolate = createFakeIsolate();
fakeVM = FakeVM(fakeIsolate); fakeVM = FakeVM(fakeIsolate);
fakeClient = FakeVmService(fakeVM); fakeClient = FakeVmService(fakeVM);
fakeClient.responses['waitFor'] = makeFakeResponse(<String, dynamic>{'status':'ok'}); fakeClient.responses['waitFor'] = makeFakeResponse(<String, dynamic>{'status':'ok'});
...@@ -92,12 +92,12 @@ void main() { ...@@ -92,12 +92,12 @@ void main() {
group('VMServiceFlutterDriver with printCommunication', () { group('VMServiceFlutterDriver with printCommunication', () {
late FakeVmService fakeClient; late FakeVmService fakeClient;
late FakeVM fakeVM; late FakeVM fakeVM;
late FakeIsolate fakeIsolate; late vms.Isolate fakeIsolate;
late VMServiceFlutterDriver driver; late VMServiceFlutterDriver driver;
setUp(() async { setUp(() async {
log.clear(); log.clear();
fakeIsolate = FakeIsolate(); fakeIsolate = createFakeIsolate();
fakeVM = FakeVM(fakeIsolate); fakeVM = FakeVM(fakeIsolate);
fakeClient = FakeVmService(fakeVM); fakeClient = FakeVmService(fakeVM);
fakeClient.responses['waitFor'] = makeFakeResponse(<String, dynamic>{'status':'ok'}); fakeClient.responses['waitFor'] = makeFakeResponse(<String, dynamic>{'status':'ok'});
...@@ -122,7 +122,7 @@ void main() { ...@@ -122,7 +122,7 @@ void main() {
group('VMServiceFlutterDriver.connect', () { group('VMServiceFlutterDriver.connect', () {
late FakeVmService fakeClient; late FakeVmService fakeClient;
late FakeVM fakeVM; late FakeVM fakeVM;
late FakeIsolate fakeIsolate; late vms.Isolate fakeIsolate;
void expectLogContains(String message) { void expectLogContains(String message) {
expect(log, anyElement(contains(message))); expect(log, anyElement(contains(message)));
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
setUp(() { setUp(() {
log.clear(); log.clear();
fakeIsolate = FakeIsolate(); fakeIsolate = createFakeIsolate();
fakeVM = FakeVM(fakeIsolate); fakeVM = FakeVM(fakeIsolate);
fakeClient = FakeVmService(fakeVM); fakeClient = FakeVmService(fakeVM);
vmServiceConnectFunction = (String url, Map<String, dynamic>? headers) async { vmServiceConnectFunction = (String url, Map<String, dynamic>? headers) async {
...@@ -190,7 +190,7 @@ void main() { ...@@ -190,7 +190,7 @@ void main() {
test('Connects to isolate number', () async { test('Connects to isolate number', () async {
fakeIsolate.pauseEvent = vms.Event(kind: vms.EventKind.kPauseStart, timestamp: 0); fakeIsolate.pauseEvent = vms.Event(kind: vms.EventKind.kPauseStart, timestamp: 0);
final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: '', isolateNumber: int.parse(fakeIsolate.number)); final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: '', isolateNumber: int.parse(fakeIsolate.number!));
expect(driver, isNotNull); expect(driver, isNotNull);
expect( expect(
fakeClient.connectionLog, fakeClient.connectionLog,
...@@ -269,7 +269,7 @@ void main() { ...@@ -269,7 +269,7 @@ void main() {
test('connects to unpaused when onExtensionAdded does not contain the ' test('connects to unpaused when onExtensionAdded does not contain the '
'driver extension', () async { 'driver extension', () async {
fakeIsolate.pauseEvent = vms.Event(kind: vms.EventKind.kResume, timestamp: 0); fakeIsolate.pauseEvent = vms.Event(kind: vms.EventKind.kResume, timestamp: 0);
fakeIsolate.extensionRPCs.add('ext.flutter.driver'); fakeIsolate.extensionRPCs!.add('ext.flutter.driver');
final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: ''); final FlutterDriver driver = await FlutterDriver.connect(dartVmServiceUrl: '');
expect(driver, isNotNull); expect(driver, isNotNull);
...@@ -280,11 +280,11 @@ void main() { ...@@ -280,11 +280,11 @@ void main() {
group('VMServiceFlutterDriver', () { group('VMServiceFlutterDriver', () {
late FakeVmService fakeClient; late FakeVmService fakeClient;
late FakeVM fakeVM; late FakeVM fakeVM;
late FakeIsolate fakeIsolate; late vms.Isolate fakeIsolate;
late VMServiceFlutterDriver driver; late VMServiceFlutterDriver driver;
setUp(() { setUp(() {
fakeIsolate = FakeIsolate(); fakeIsolate = createFakeIsolate();
fakeVM = FakeVM(fakeIsolate); fakeVM = FakeVM(fakeIsolate);
fakeClient = FakeVmService(fakeVM); fakeClient = FakeVmService(fakeVM);
driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate); driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate);
...@@ -688,11 +688,11 @@ void main() { ...@@ -688,11 +688,11 @@ void main() {
group('VMServiceFlutterDriver with custom timeout', () { group('VMServiceFlutterDriver with custom timeout', () {
late FakeVmService fakeClient; late FakeVmService fakeClient;
late FakeVM fakeVM; late FakeVM fakeVM;
late FakeIsolate fakeIsolate; late vms.Isolate fakeIsolate;
late VMServiceFlutterDriver driver; late VMServiceFlutterDriver driver;
setUp(() { setUp(() {
fakeIsolate = FakeIsolate(); fakeIsolate = createFakeIsolate();
fakeVM = FakeVM(fakeIsolate); fakeVM = FakeVM(fakeIsolate);
fakeClient = FakeVmService(fakeVM); fakeClient = FakeVmService(fakeVM);
driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate); driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate);
...@@ -1217,16 +1217,19 @@ class FakeVM extends Fake implements vms.VM { ...@@ -1217,16 +1217,19 @@ class FakeVM extends Fake implements vms.VM {
} }
} }
class FakeIsolate extends Fake implements vms.Isolate { vms.Isolate createFakeIsolate() => vms.Isolate(
@override id: '123',
String get number => '123'; number: '123',
name: null,
@override isSystemIsolate: null,
String get id => number; isolateFlags: null,
startTime: null,
@override runnable: null,
vms.Event? pauseEvent; livePorts: null,
pauseOnExit: null,
@override pauseEvent: null,
List<String> get extensionRPCs => <String>[]; libraries: null,
} breakpoints: null,
exceptionPauseMode: null,
extensionRPCs: <String>[],
);
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
import 'dart:typed_data' show ByteData; import 'dart:typed_data' show ByteData;
import 'dart:ui' as ui hide window; import 'dart:ui' as ui hide window;
import 'package:flutter/foundation.dart';
/// [SingletonFlutterWindow] that wraps another [SingletonFlutterWindow] and /// [SingletonFlutterWindow] that wraps another [SingletonFlutterWindow] and
/// allows faking of some properties for testing purposes. /// allows faking of some properties for testing purposes.
/// ///
...@@ -342,6 +344,9 @@ class TestWindow implements ui.SingletonFlutterWindow { ...@@ -342,6 +344,9 @@ class TestWindow implements ui.SingletonFlutterWindow {
ui.AccessibilityFeatures? _accessibilityFeaturesTestValue; ui.AccessibilityFeatures? _accessibilityFeaturesTestValue;
/// Hides the real accessibility features and reports the given /// Hides the real accessibility features and reports the given
/// [accessibilityFeaturesTestValue] instead. /// [accessibilityFeaturesTestValue] instead.
///
/// Consider using [FakeAccessibilityFeatures] to provide specific
/// values for the various accessibility features under test.
set accessibilityFeaturesTestValue(ui.AccessibilityFeatures accessibilityFeaturesTestValue) { // ignore: avoid_setters_without_getters set accessibilityFeaturesTestValue(ui.AccessibilityFeatures accessibilityFeaturesTestValue) { // ignore: avoid_setters_without_getters
_accessibilityFeaturesTestValue = accessibilityFeaturesTestValue; _accessibilityFeaturesTestValue = accessibilityFeaturesTestValue;
onAccessibilityFeaturesChanged?.call(); onAccessibilityFeaturesChanged?.call();
...@@ -429,8 +434,85 @@ class TestWindow implements ui.SingletonFlutterWindow { ...@@ -429,8 +434,85 @@ class TestWindow implements ui.SingletonFlutterWindow {
} }
/// This gives us some grace time when the dart:ui side adds something to /// This gives us some grace time when the dart:ui side adds something to
/// Window, and makes things easier when we do rolls to give us time to catch /// [SingletonFlutterWindow], and makes things easier when we do rolls to give
/// up. /// us time to catch up.
@override
dynamic noSuchMethod(Invocation invocation) {
return null;
}
}
/// Test version of [AccessibilityFeatures] in which specific features may
/// be set to arbitrary values.
///
/// By default, all features are disabled. For an instance where all the
/// features are enabled, consider the [FakeAccessibilityFeatures.allOn]
/// constant.
@immutable
// ignore: avoid_implementing_value_types
class FakeAccessibilityFeatures implements ui.AccessibilityFeatures {
/// Creates a test instance of [AccessibilityFeatures].
///
/// By default, all features are disabled.
const FakeAccessibilityFeatures({
this.accessibleNavigation = false,
this.invertColors = false,
this.disableAnimations = false,
this.boldText = false,
this.reduceMotion = false,
this.highContrast = false,
});
/// An instance of [AccessibilityFeatures] where all the features are enabled.
static const FakeAccessibilityFeatures allOn = FakeAccessibilityFeatures(
accessibleNavigation: true,
invertColors: true,
disableAnimations: true,
boldText: true,
reduceMotion: true,
highContrast: true,
);
@override
final bool accessibleNavigation;
@override
final bool invertColors;
@override
final bool disableAnimations;
@override
final bool boldText;
@override
final bool reduceMotion;
@override
final bool highContrast;
@override
bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is FakeAccessibilityFeatures
&& other.accessibleNavigation == accessibleNavigation
&& other.invertColors == invertColors
&& other.disableAnimations == disableAnimations
&& other.boldText == boldText
&& other.reduceMotion == reduceMotion
&& other.highContrast == highContrast;
}
@override
int get hashCode => ui.hashValues(accessibleNavigation, invertColors, disableAnimations, boldText, reduceMotion, highContrast);
/// This gives us some grace time when the dart:ui side adds something to
/// [AccessibilityFeatures], and makes things easier when we do rolls to
/// give us time to catch up.
///
/// If you would like to add to this class, changes must first be made in the
/// engine, followed by the framework.
@override @override
dynamic noSuchMethod(Invocation invocation) { dynamic noSuchMethod(Invocation invocation) {
return null; return null;
......
...@@ -123,8 +123,8 @@ void main() { ...@@ -123,8 +123,8 @@ void main() {
]), ]),
...<PointerEventRecord>[ ...<PointerEventRecord>[
for (Duration t = const Duration(milliseconds: 5); for (Duration t = const Duration(milliseconds: 5);
t < const Duration(milliseconds: 80); t < const Duration(milliseconds: 80);
t += const Duration(milliseconds: 16)) t += const Duration(milliseconds: 16))
PointerEventRecord(t, <PointerEvent>[ PointerEventRecord(t, <PointerEvent>[
PointerMoveEvent( PointerMoveEvent(
timeStamp: t - const Duration(milliseconds: 1), timeStamp: t - const Duration(milliseconds: 1),
...@@ -149,7 +149,7 @@ void main() { ...@@ -149,7 +149,7 @@ void main() {
expect(timeDiffs.length, records.length); expect(timeDiffs.length, records.length);
for (final Duration diff in timeDiffs) { for (final Duration diff in timeDiffs) {
// Allow some freedom of time delay in real world. // Allow some freedom of time delay in real world.
assert(diff.inMilliseconds > -1); assert(diff.inMilliseconds > -1, 'timeDiffs were: $timeDiffs (offending time was ${diff.inMilliseconds}ms)');
} }
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
......
...@@ -249,46 +249,6 @@ class FakeWindowPadding implements WindowPadding { ...@@ -249,46 +249,6 @@ class FakeWindowPadding implements WindowPadding {
final double bottom; final double bottom;
} }
class FakeAccessibilityFeatures implements AccessibilityFeatures {
const FakeAccessibilityFeatures({
this.accessibleNavigation = false,
this.invertColors = false,
this.disableAnimations = false,
this.boldText = false,
this.reduceMotion = false,
this.highContrast = false,
});
@override
final bool accessibleNavigation;
@override
final bool invertColors;
@override
final bool disableAnimations;
@override
final bool boldText;
@override
final bool reduceMotion;
@override
final bool highContrast;
/// This gives us some grace time when the dart:ui side adds something to
/// [AccessibilityFeatures], and makes things easier when we do rolls to
/// give us time to catch up.
///
/// If you would like to add to this class, changes must first be made in the
/// engine, followed by the framework.
@override
dynamic noSuchMethod(Invocation invocation) {
return null;
}
}
class TestObserver with WidgetsBindingObserver { class TestObserver with WidgetsBindingObserver {
List<Locale>? locales; List<Locale>? locales;
Locale? locale; Locale? locale;
......
...@@ -778,6 +778,9 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService ...@@ -778,6 +778,9 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService
Uri get uri => Uri.parse('http://localhost:8181'); Uri get uri => Uri.parse('http://localhost:8181');
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeAndroidDevice extends Fake implements AndroidDevice { class FakeAndroidDevice extends Fake implements AndroidDevice {
FakeAndroidDevice({@required this.id}); FakeAndroidDevice({@required this.id});
...@@ -837,6 +840,9 @@ class FakeAndroidDevice extends Fake implements AndroidDevice { ...@@ -837,6 +840,9 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
Category get category => Category.mobile; Category get category => Category.mobile;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeIOSDevice extends Fake implements IOSDevice { class FakeIOSDevice extends Fake implements IOSDevice {
FakeIOSDevice({this.dds, this.portForwarder, this.logReader}); FakeIOSDevice({this.dds, this.portForwarder, this.logReader});
......
...@@ -563,6 +563,9 @@ class FakeIOSWorkflow extends Fake implements IOSWorkflow { ...@@ -563,6 +563,9 @@ class FakeIOSWorkflow extends Fake implements IOSWorkflow {
final bool canListDevices; final bool canListDevices;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeAndroidDevice extends Fake implements AndroidDevice { class FakeAndroidDevice extends Fake implements AndroidDevice {
@override @override
final String id = 'device'; final String id = 'device';
......
...@@ -1021,6 +1021,9 @@ class FakeDeviceManager extends Fake implements DeviceManager { ...@@ -1021,6 +1021,9 @@ class FakeDeviceManager extends Fake implements DeviceManager {
Future<List<String>> getDeviceDiagnostics() async => diagnostics; Future<List<String>> getDeviceDiagnostics() async => diagnostics;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
String get name => 'name'; String get name => 'name';
......
...@@ -102,6 +102,9 @@ void main() { ...@@ -102,6 +102,9 @@ void main() {
}); });
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class ScreenshotDevice extends Fake implements Device { class ScreenshotDevice extends Fake implements Device {
@override @override
Future<void> takeScreenshot(File outputFile) async {} Future<void> takeScreenshot(File outputFile) async {}
......
...@@ -78,6 +78,9 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa ...@@ -78,6 +78,9 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa
class FakeIOSApp extends Fake implements IOSApp { } class FakeIOSApp extends Fake implements IOSApp { }
class FakeAndroidApk extends Fake implements AndroidApk { } class FakeAndroidApk extends Fake implements AndroidApk { }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeIOSDevice extends Fake implements IOSDevice { class FakeIOSDevice extends Fake implements IOSDevice {
@override @override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios; Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
...@@ -95,6 +98,9 @@ class FakeIOSDevice extends Fake implements IOSDevice { ...@@ -95,6 +98,9 @@ class FakeIOSDevice extends Fake implements IOSDevice {
}) async => true; }) async => true;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeAndroidDevice extends Fake implements AndroidDevice { class FakeAndroidDevice extends Fake implements AndroidDevice {
@override @override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm; Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
......
...@@ -475,6 +475,9 @@ class TestRunCommand extends RunCommand { ...@@ -475,6 +475,9 @@ class TestRunCommand extends RunCommand {
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
FakeDevice({bool isLocalEmulator = false, TargetPlatform targetPlatform = TargetPlatform.ios, String sdkNameAndVersion = ''}) FakeDevice({bool isLocalEmulator = false, TargetPlatform targetPlatform = TargetPlatform.ios, String sdkNameAndVersion = ''})
: _isLocalEmulator = isLocalEmulator, : _isLocalEmulator = isLocalEmulator,
......
...@@ -190,6 +190,9 @@ AndroidDevice createFakeDevice(int sdkLevel) { ...@@ -190,6 +190,9 @@ AndroidDevice createFakeDevice(int sdkLevel) {
); );
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeAndroidDevice extends Fake implements AndroidDevice { class FakeAndroidDevice extends Fake implements AndroidDevice {
FakeAndroidDevice(this._apiVersion, this._lastLogcatTimestamp); FakeAndroidDevice(this._apiVersion, this._lastLogcatTimestamp);
......
...@@ -175,6 +175,9 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -175,6 +175,9 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
Future<void> initLogReader() async { } Future<void> initLogReader() async { }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
bool isSupported() => true; bool isSupported() => true;
......
...@@ -531,6 +531,9 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa ...@@ -531,6 +531,9 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa
class FakeApplicationPackage extends Fake implements ApplicationPackage { } class FakeApplicationPackage extends Fake implements ApplicationPackage { }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
FakeDevice(this.result, {this.supportsFlutterExit = true}); FakeDevice(this.result, {this.supportsFlutterExit = true});
......
...@@ -283,6 +283,9 @@ WebDriverService setUpDriverService() { ...@@ -283,6 +283,9 @@ WebDriverService setUpDriverService() {
); );
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
final PlatformType platformType = PlatformType.web; final PlatformType platformType = PlatformType.web;
......
...@@ -887,6 +887,9 @@ class FuchsiaModulePackage extends ApplicationPackage { ...@@ -887,6 +887,9 @@ class FuchsiaModulePackage extends ApplicationPackage {
final String name; final String name;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class MockFuchsiaDevice extends Fake implements FuchsiaDevice { class MockFuchsiaDevice extends Fake implements FuchsiaDevice {
MockFuchsiaDevice(this.id, this.portForwarder, this._ipv6); MockFuchsiaDevice(this.id, this.portForwarder, this._ipv6);
......
...@@ -606,6 +606,9 @@ class FakeDevFs extends Fake implements DevFS { ...@@ -606,6 +606,9 @@ class FakeDevFs extends Fake implements DevFS {
Uri baseUri; Uri baseUri;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
bool disposed = false; bool disposed = false;
......
...@@ -288,6 +288,9 @@ class FakeMDnsClient extends Fake implements MDnsClient { ...@@ -288,6 +288,9 @@ class FakeMDnsClient extends Fake implements MDnsClient {
void stop() {} void stop() {}
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeIOSDevice extends Fake implements IOSDevice { class FakeIOSDevice extends Fake implements IOSDevice {
@override @override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios; Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
......
...@@ -471,4 +471,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -471,4 +471,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
TargetPlatform targetPlatform = TargetPlatform.android_arm; TargetPlatform targetPlatform = TargetPlatform.android_arm;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { } class FakeDevice extends Fake implements Device { }
...@@ -2220,6 +2220,9 @@ class FakeProjectFileInvalidator extends Fake implements ProjectFileInvalidator ...@@ -2220,6 +2220,9 @@ class FakeProjectFileInvalidator extends Fake implements ProjectFileInvalidator
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
FakeDevice({ FakeDevice({
String sdkNameAndVersion = 'Android', String sdkNameAndVersion = 'Android',
......
...@@ -193,6 +193,9 @@ class FakeWebDevFS extends Fake implements WebDevFS { ...@@ -193,6 +193,9 @@ class FakeWebDevFS extends Fake implements WebDevFS {
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeWebDevice extends Fake implements Device { class FakeWebDevice extends Fake implements Device {
@override @override
String get name => 'web'; String get name => 'web';
......
...@@ -1030,8 +1030,14 @@ ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice, { ...@@ -1030,8 +1030,14 @@ ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice, {
); );
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeWebServerDevice extends FakeDevice implements WebServerDevice { } class FakeWebServerDevice extends FakeDevice implements WebServerDevice { }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
String name; String name;
...@@ -1101,6 +1107,9 @@ class FakeAppConnection extends Fake implements AppConnection { ...@@ -1101,6 +1107,9 @@ class FakeAppConnection extends Fake implements AppConnection {
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeChromeDevice extends Fake implements ChromiumDevice { } class FakeChromeDevice extends Fake implements ChromiumDevice { }
class FakeWipDebugger extends Fake implements WipDebugger { } class FakeWipDebugger extends Fake implements WipDebugger { }
......
...@@ -1372,6 +1372,9 @@ class FakeResidentDevtoolsHandler extends Fake implements ResidentDevtoolsHandle ...@@ -1372,6 +1372,9 @@ class FakeResidentDevtoolsHandler extends Fake implements ResidentDevtoolsHandle
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
bool isSupported() => true; bool isSupported() => true;
......
...@@ -835,6 +835,9 @@ class MockVMService extends Fake implements vm_service.VmService { ...@@ -835,6 +835,9 @@ class MockVMService extends Fake implements vm_service.VmService {
} }
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`.
// Until we fix that, we have to also ignore related lints here.
// ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { } class FakeDevice extends Fake implements Device { }
class FakeFlutterVersion extends Fake implements FlutterVersion { class FakeFlutterVersion extends Fake implements FlutterVersion {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment