Audit covariant usage in tool (#116930)
This commit is contained in:
@@ -6,7 +6,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/android/android_device.dart';
|
||||
import 'package:flutter_tools/src/android/application_package.dart';
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/common.dart';
|
||||
import 'package:flutter_tools/src/base/dds.dart';
|
||||
@@ -947,7 +947,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
|
||||
@override
|
||||
FutureOr<DeviceLogReader> getLogReader({
|
||||
AndroidApk? app,
|
||||
ApplicationPackage? app,
|
||||
bool includePastLogs = false,
|
||||
}) {
|
||||
if (onGetLogReader == null) {
|
||||
|
||||
@@ -886,15 +886,16 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
late DeviceLogReader logReader;
|
||||
@override
|
||||
FutureOr<DeviceLogReader> getLogReader({
|
||||
covariant ApplicationPackage? app,
|
||||
ApplicationPackage? app,
|
||||
bool includePastLogs = false,
|
||||
}) => logReader;
|
||||
|
||||
ApplicationPackage? startAppPackage;
|
||||
late LaunchResult launchResult;
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
ApplicationPackage package, {
|
||||
ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
|
||||
@@ -148,7 +148,7 @@ class FakeIOSDevice extends Fake implements IOSDevice {
|
||||
|
||||
@override
|
||||
Future<bool> isAppInstalled(
|
||||
IOSApp app, {
|
||||
ApplicationPackage app, {
|
||||
String? userIdentifier,
|
||||
}) async => false;
|
||||
|
||||
@@ -168,7 +168,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
|
||||
@override
|
||||
Future<bool> isAppInstalled(
|
||||
AndroidApk app, {
|
||||
ApplicationPackage app, {
|
||||
String? userIdentifier,
|
||||
}) async => false;
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
late DeviceLogReader logReader;
|
||||
@override
|
||||
FutureOr<DeviceLogReader> getLogReader({
|
||||
covariant ApplicationPackage? app,
|
||||
ApplicationPackage? app,
|
||||
bool includePastLogs = false,
|
||||
}) => logReader;
|
||||
|
||||
@@ -310,7 +310,7 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
|
||||
late LaunchResult launchResult;
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
ApplicationPackage package, {
|
||||
ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
|
||||
@@ -990,7 +990,7 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
DevFSWriter? createDevFSWriter(
|
||||
covariant ApplicationPackage? app,
|
||||
ApplicationPackage? app,
|
||||
String? userIdentifier,
|
||||
) {
|
||||
return null;
|
||||
|
||||
@@ -137,6 +137,7 @@ void main() {
|
||||
expect(await device.isLatestBuildInstalled(linuxApp), false);
|
||||
expect(await device.isAppInstalled(linuxApp), false);
|
||||
expect(await device.stopApp(linuxApp), false);
|
||||
expect(await device.stopApp(null), false);
|
||||
expect(device.category, Category.mobile);
|
||||
|
||||
expect(device.supportsRuntimeMode(BuildMode.debug), true);
|
||||
|
||||
@@ -357,8 +357,7 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
bool isSupportedForProject(FlutterProject flutterProject) => true;
|
||||
|
||||
@override
|
||||
Future<void> buildForDevice(
|
||||
ApplicationPackage package, {
|
||||
Future<void> buildForDevice({
|
||||
String? mainPath,
|
||||
BuildInfo? buildInfo,
|
||||
}) async {
|
||||
|
||||
@@ -503,13 +503,13 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<DeviceLogReader> getLogReader({
|
||||
covariant ApplicationPackage? app,
|
||||
ApplicationPackage? app,
|
||||
bool includePastLogs = false,
|
||||
}) async => NoOpDeviceLogReader('test');
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
covariant ApplicationPackage package, {
|
||||
ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
@@ -526,13 +526,13 @@ class FakeDevice extends Fake implements Device {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(covariant ApplicationPackage app, {String? userIdentifier}) async {
|
||||
Future<bool> stopApp(ApplicationPackage? app, {String? userIdentifier}) async {
|
||||
didStopApp = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> uninstallApp(covariant ApplicationPackage app, {String? userIdentifier}) async {
|
||||
Future<bool> uninstallApp(ApplicationPackage app, {String? userIdentifier}) async {
|
||||
didUninstallApp = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(
|
||||
covariant ApplicationPackage? app, {
|
||||
ApplicationPackage? app, {
|
||||
String? userIdentifier,
|
||||
}) async {
|
||||
return true;
|
||||
|
||||
@@ -141,7 +141,7 @@ void main() {
|
||||
),
|
||||
throwsA(isA<UnimplementedError>()),
|
||||
);
|
||||
await expectLater(() => device.buildForDevice(FakeIOSApp(), buildInfo: BuildInfo.debug), throwsA(isA<UnimplementedError>()));
|
||||
await expectLater(() => device.buildForDevice(buildInfo: BuildInfo.debug), throwsA(isA<UnimplementedError>()));
|
||||
expect(device.executablePathForDevice(FakeIOSApp(), BuildMode.debug), null);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2649,7 +2649,7 @@ class FakeDevice extends Fake implements Device {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(covariant ApplicationPackage? app, {String? userIdentifier}) async {
|
||||
Future<bool> stopApp(ApplicationPackage? app, {String? userIdentifier}) async {
|
||||
appStopped = true;
|
||||
return true;
|
||||
}
|
||||
@@ -2664,7 +2664,7 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
FutureOr<DeviceLogReader> getLogReader({
|
||||
covariant ApplicationPackage? app,
|
||||
ApplicationPackage? app,
|
||||
bool includePastLogs = false,
|
||||
}) => NoOpDeviceLogReader(name);
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ class FakeWebDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(
|
||||
covariant ApplicationPackage? app, {
|
||||
ApplicationPackage? app, {
|
||||
String? userIdentifier,
|
||||
}) async {
|
||||
return true;
|
||||
@@ -197,7 +197,7 @@ class FakeWebDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
covariant ApplicationPackage? package, {
|
||||
ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
|
||||
@@ -1273,7 +1273,7 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(
|
||||
covariant ApplicationPackage? package, {
|
||||
ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
@@ -1287,7 +1287,7 @@ class FakeDevice extends Fake implements Device {
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(
|
||||
covariant ApplicationPackage? app, {
|
||||
ApplicationPackage? app, {
|
||||
String? userIdentifier,
|
||||
}) async {
|
||||
if (count > 0) {
|
||||
|
||||
@@ -82,7 +82,7 @@ class FakeDevice extends Device {
|
||||
final String name;
|
||||
|
||||
@override
|
||||
Future<LaunchResult> startApp(covariant ApplicationPackage package, {
|
||||
Future<LaunchResult> startApp(ApplicationPackage? package, {
|
||||
String? mainPath,
|
||||
String? route,
|
||||
DebuggingOptions? debuggingOptions,
|
||||
@@ -93,13 +93,13 @@ class FakeDevice extends Device {
|
||||
}) async => _launchResult;
|
||||
|
||||
@override
|
||||
Future<bool> stopApp(covariant ApplicationPackage app, {
|
||||
Future<bool> stopApp(ApplicationPackage? app, {
|
||||
String? userIdentifier,
|
||||
}) async => true;
|
||||
|
||||
@override
|
||||
Future<bool> uninstallApp(
|
||||
covariant ApplicationPackage app, {
|
||||
ApplicationPackage app, {
|
||||
String? userIdentifier,
|
||||
}) async => true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user