Unverified Commit 4453ba0a authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Null safety migration of packages/flutter_tools/test/general.shard, part 2/2 (#110712)

* Migrate packages/flutter_tools/test/general.shard, part 2/2

* Fix analysis

* Fix tests

* Fix analysis

* Apply suggestions from code review
Co-authored-by: 's avatarChristopher Fujino <fujino@google.com>
Co-authored-by: 's avatarChristopher Fujino <fujino@google.com>
parent 6c79dcca
...@@ -707,7 +707,7 @@ abstract class ResidentHandlers { ...@@ -707,7 +707,7 @@ abstract class ResidentHandlers {
} }
final List<FlutterView> views = await device!.vmService!.getFlutterViews(); final List<FlutterView> views = await device!.vmService!.getFlutterViews();
for (final FlutterView view in views) { for (final FlutterView view in views) {
final Map<String, Object>? rasterData = final Map<String, Object?>? rasterData =
await device.vmService!.renderFrameWithRasterStats( await device.vmService!.renderFrameWithRasterStats(
viewId: view.id, viewId: view.id,
uiIsolateId: view.uiIsolate!.id, uiIsolateId: view.uiIsolate!.id,
......
...@@ -557,7 +557,7 @@ class FlutterVmService { ...@@ -557,7 +557,7 @@ class FlutterVmService {
/// for rasterization which is not reflective of how long the frame takes in /// for rasterization which is not reflective of how long the frame takes in
/// production. This is primarily intended to be used to identify the layers /// production. This is primarily intended to be used to identify the layers
/// that result in the most raster perf degradation. /// that result in the most raster perf degradation.
Future<Map<String, Object>?> renderFrameWithRasterStats({ Future<Map<String, Object?>?> renderFrameWithRasterStats({
required String? viewId, required String? viewId,
required String? uiIsolateId, required String? uiIsolateId,
}) async { }) async {
...@@ -568,7 +568,7 @@ class FlutterVmService { ...@@ -568,7 +568,7 @@ class FlutterVmService {
'viewId': viewId, 'viewId': viewId,
}, },
); );
return response?.json as Map<String, Object>?; return response?.json;
} }
Future<String> flutterDebugDumpApp({ Future<String> flutterDebugDumpApp({
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_sdk.dart'; import 'package:flutter_tools/src/android/android_sdk.dart';
...@@ -30,10 +28,10 @@ import '../src/fakes.dart'; ...@@ -30,10 +28,10 @@ import '../src/fakes.dart';
void main() { void main() {
group('Apk with partial Android SDK works', () { group('Apk with partial Android SDK works', () {
FakeAndroidSdk sdk; late FakeAndroidSdk sdk;
FakeProcessManager fakeProcessManager; late FakeProcessManager fakeProcessManager;
MemoryFileSystem fs; late MemoryFileSystem fs;
Cache cache; late Cache cache;
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
AndroidSdk: () => sdk, AndroidSdk: () => sdk,
...@@ -79,11 +77,10 @@ void main() { ...@@ -79,11 +77,10 @@ void main() {
) )
); );
final ApplicationPackage applicationPackage = await ApplicationPackageFactory.instance.getPackageForPlatform( final ApplicationPackage applicationPackage = (await ApplicationPackageFactory.instance!.getPackageForPlatform(
TargetPlatform.android_arm, TargetPlatform.android_arm,
buildInfo: null,
applicationBinary: apkFile, applicationBinary: apkFile,
); ))!;
expect(applicationPackage.name, 'app.apk'); expect(applicationPackage.name, 'app.apk');
expect(applicationPackage, isA<PrebuiltApplicationPackage>()); expect(applicationPackage, isA<PrebuiltApplicationPackage>());
expect((applicationPackage as PrebuiltApplicationPackage).applicationPackage.path, apkFile.path); expect((applicationPackage as PrebuiltApplicationPackage).applicationPackage.path, apkFile.path);
...@@ -104,9 +101,8 @@ void main() { ...@@ -104,9 +101,8 @@ void main() {
gradleWrapperDir.childFile('gradlew').writeAsStringSync('irrelevant'); gradleWrapperDir.childFile('gradlew').writeAsStringSync('irrelevant');
gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant'); gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant');
await ApplicationPackageFactory.instance.getPackageForPlatform( await ApplicationPackageFactory.instance!.getPackageForPlatform(
TargetPlatform.android_arm, TargetPlatform.android_arm,
buildInfo: null,
applicationBinary: globals.fs.file('app.apk'), applicationBinary: globals.fs.file('app.apk'),
); );
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
...@@ -116,19 +112,16 @@ void main() { ...@@ -116,19 +112,16 @@ void main() {
final AndroidSdkVersion sdkVersion = FakeAndroidSdkVersion(); final AndroidSdkVersion sdkVersion = FakeAndroidSdkVersion();
sdk.latestVersion = sdkVersion; sdk.latestVersion = sdkVersion;
await ApplicationPackageFactory.instance.getPackageForPlatform( await ApplicationPackageFactory.instance!.getPackageForPlatform(
TargetPlatform.android_arm, TargetPlatform.android_arm,
buildInfo: null,
); );
expect(fakeProcessManager, hasNoRemainingExpectations); expect(fakeProcessManager, hasNoRemainingExpectations);
}, overrides: overrides); }, overrides: overrides);
testWithoutContext('returns null when failed to extract manifest', () async { testWithoutContext('returns null when failed to extract manifest', () async {
final AndroidSdkVersion sdkVersion = FakeAndroidSdkVersion();
sdk.latestVersion = sdkVersion;
final Logger logger = BufferLogger.test(); final Logger logger = BufferLogger.test();
final AndroidApk androidApk = AndroidApk.fromApk( final AndroidApk? androidApk = AndroidApk.fromApk(
null, fs.file(''),
processManager: fakeProcessManager, processManager: fakeProcessManager,
logger: logger, logger: logger,
userMessages: UserMessages(), userMessages: UserMessages(),
...@@ -146,7 +139,7 @@ void main() { ...@@ -146,7 +139,7 @@ void main() {
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData data = ApkManifestData.parseFromXmlDump(
_aaptDataWithExplicitEnabledAndMainLauncherActivity, _aaptDataWithExplicitEnabledAndMainLauncherActivity,
BufferLogger.test(), BufferLogger.test(),
); )!;
expect(data, isNotNull); expect(data, isNotNull);
expect(data.packageName, 'io.flutter.examples.hello_world'); expect(data.packageName, 'io.flutter.examples.hello_world');
...@@ -157,7 +150,7 @@ void main() { ...@@ -157,7 +150,7 @@ void main() {
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData data = ApkManifestData.parseFromXmlDump(
_aaptDataWithDefaultEnabledAndMainLauncherActivity, _aaptDataWithDefaultEnabledAndMainLauncherActivity,
BufferLogger.test(), BufferLogger.test(),
); )!;
expect(data, isNotNull); expect(data, isNotNull);
expect(data.packageName, 'io.flutter.examples.hello_world'); expect(data.packageName, 'io.flutter.examples.hello_world');
...@@ -168,7 +161,7 @@ void main() { ...@@ -168,7 +161,7 @@ void main() {
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData data = ApkManifestData.parseFromXmlDump(
_aaptDataWithDistNamespace, _aaptDataWithDistNamespace,
BufferLogger.test(), BufferLogger.test(),
); )!;
expect(data, isNotNull); expect(data, isNotNull);
expect(data.packageName, 'io.flutter.examples.hello_world'); expect(data.packageName, 'io.flutter.examples.hello_world');
...@@ -177,7 +170,7 @@ void main() { ...@@ -177,7 +170,7 @@ void main() {
testWithoutContext('Error when parsing manifest with no Activity that has enabled set to true nor has no value for its enabled field', () { testWithoutContext('Error when parsing manifest with no Activity that has enabled set to true nor has no value for its enabled field', () {
final BufferLogger logger = BufferLogger.test(); final BufferLogger logger = BufferLogger.test();
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData? data = ApkManifestData.parseFromXmlDump(
_aaptDataWithNoEnabledActivity, _aaptDataWithNoEnabledActivity,
logger, logger,
); );
...@@ -191,7 +184,7 @@ void main() { ...@@ -191,7 +184,7 @@ void main() {
testWithoutContext('Error when parsing manifest with no Activity that has action set to android.intent.action.MAIN', () { testWithoutContext('Error when parsing manifest with no Activity that has action set to android.intent.action.MAIN', () {
final BufferLogger logger = BufferLogger.test(); final BufferLogger logger = BufferLogger.test();
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData? data = ApkManifestData.parseFromXmlDump(
_aaptDataWithNoMainActivity, _aaptDataWithNoMainActivity,
logger, logger,
); );
...@@ -205,7 +198,7 @@ void main() { ...@@ -205,7 +198,7 @@ void main() {
testWithoutContext('Error when parsing manifest with no Activity that has category set to android.intent.category.LAUNCHER', () { testWithoutContext('Error when parsing manifest with no Activity that has category set to android.intent.category.LAUNCHER', () {
final BufferLogger logger = BufferLogger.test(); final BufferLogger logger = BufferLogger.test();
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData? data = ApkManifestData.parseFromXmlDump(
_aaptDataWithNoLauncherActivity, _aaptDataWithNoLauncherActivity,
logger, logger,
); );
...@@ -221,7 +214,7 @@ void main() { ...@@ -221,7 +214,7 @@ void main() {
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData data = ApkManifestData.parseFromXmlDump(
_aaptDataWithLauncherAndDefaultActivity, _aaptDataWithLauncherAndDefaultActivity,
BufferLogger.test(), BufferLogger.test(),
); )!;
expect(data, isNotNull); expect(data, isNotNull);
expect(data.packageName, 'io.flutter.examples.hello_world'); expect(data.packageName, 'io.flutter.examples.hello_world');
...@@ -229,7 +222,7 @@ void main() { ...@@ -229,7 +222,7 @@ void main() {
}); });
testWithoutContext('Parses manifest with missing application tag', () async { testWithoutContext('Parses manifest with missing application tag', () async {
final ApkManifestData data = ApkManifestData.parseFromXmlDump( final ApkManifestData? data = ApkManifestData.parseFromXmlDump(
_aaptDataWithoutApplication, _aaptDataWithoutApplication,
BufferLogger.test(), BufferLogger.test(),
); );
...@@ -239,8 +232,8 @@ void main() { ...@@ -239,8 +232,8 @@ void main() {
}); });
group('PrebuiltIOSApp', () { group('PrebuiltIOSApp', () {
FakeOperatingSystemUtils os; late FakeOperatingSystemUtils os;
FakePlistParser testPlistParser; late FakePlistParser testPlistParser;
final Map<Type, Generator> overrides = <Type, Generator>{ final Map<Type, Generator> overrides = <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
...@@ -255,8 +248,8 @@ void main() { ...@@ -255,8 +248,8 @@ void main() {
}); });
testUsingContext('Error on non-existing file', () { testUsingContext('Error on non-existing file', () {
final PrebuiltIOSApp iosApp = final PrebuiltIOSApp? iosApp =
IOSApp.fromPrebuiltApp(globals.fs.file('not_existing.ipa')) as PrebuiltIOSApp; IOSApp.fromPrebuiltApp(globals.fs.file('not_existing.ipa')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -266,8 +259,8 @@ void main() { ...@@ -266,8 +259,8 @@ void main() {
testUsingContext('Error on non-app-bundle folder', () { testUsingContext('Error on non-app-bundle folder', () {
globals.fs.directory('regular_folder').createSync(); globals.fs.directory('regular_folder').createSync();
final PrebuiltIOSApp iosApp = final PrebuiltIOSApp? iosApp =
IOSApp.fromPrebuiltApp(globals.fs.file('regular_folder')) as PrebuiltIOSApp; IOSApp.fromPrebuiltApp(globals.fs.file('regular_folder')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect( expect(
testLogger.errorText, 'Folder "regular_folder" is not an app bundle.\n'); testLogger.errorText, 'Folder "regular_folder" is not an app bundle.\n');
...@@ -275,7 +268,7 @@ void main() { ...@@ -275,7 +268,7 @@ void main() {
testUsingContext('Error on no info.plist', () { testUsingContext('Error on no info.plist', () {
globals.fs.directory('bundle.app').createSync(); globals.fs.directory('bundle.app').createSync();
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp; final PrebuiltIOSApp? iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -286,7 +279,7 @@ void main() { ...@@ -286,7 +279,7 @@ void main() {
testUsingContext('Error on bad info.plist', () { testUsingContext('Error on bad info.plist', () {
globals.fs.directory('bundle.app').createSync(); globals.fs.directory('bundle.app').createSync();
globals.fs.file('bundle.app/Info.plist').createSync(); globals.fs.file('bundle.app/Info.plist').createSync();
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp; final PrebuiltIOSApp? iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -299,7 +292,7 @@ void main() { ...@@ -299,7 +292,7 @@ void main() {
globals.fs.directory('bundle.app').createSync(); globals.fs.directory('bundle.app').createSync();
globals.fs.file('bundle.app/Info.plist').createSync(); globals.fs.file('bundle.app/Info.plist').createSync();
testPlistParser.setProperty('CFBundleIdentifier', 'fooBundleId'); testPlistParser.setProperty('CFBundleIdentifier', 'fooBundleId');
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp; final PrebuiltIOSApp iosApp = (IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp?)!;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(iosApp.uncompressedBundle.path, 'bundle.app'); expect(iosApp.uncompressedBundle.path, 'bundle.app');
expect(iosApp.id, 'fooBundleId'); expect(iosApp.id, 'fooBundleId');
...@@ -309,7 +302,7 @@ void main() { ...@@ -309,7 +302,7 @@ void main() {
testUsingContext('Bad ipa zip-file, no payload dir', () { testUsingContext('Bad ipa zip-file, no payload dir', () {
globals.fs.file('app.ipa').createSync(); globals.fs.file('app.ipa').createSync();
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp; final PrebuiltIOSApp? iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -330,7 +323,7 @@ void main() { ...@@ -330,7 +323,7 @@ void main() {
globals.fs.directory(bundlePath1).createSync(recursive: true); globals.fs.directory(bundlePath1).createSync(recursive: true);
globals.fs.directory(bundlePath2).createSync(recursive: true); globals.fs.directory(bundlePath2).createSync(recursive: true);
}; };
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp; final PrebuiltIOSApp? iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp?;
expect(iosApp, isNull); expect(iosApp, isNull);
expect(testLogger.errorText, expect(testLogger.errorText,
'Invalid prebuilt iOS ipa. Does not contain a single app bundle.\n'); 'Invalid prebuilt iOS ipa. Does not contain a single app bundle.\n');
...@@ -350,7 +343,7 @@ void main() { ...@@ -350,7 +343,7 @@ void main() {
.file(globals.fs.path.join(bundleAppDir.path, 'Info.plist')) .file(globals.fs.path.join(bundleAppDir.path, 'Info.plist'))
.createSync(); .createSync();
}; };
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp; final PrebuiltIOSApp iosApp = (IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp?)!;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(iosApp.uncompressedBundle.path, endsWith('bundle.app')); expect(iosApp.uncompressedBundle.path, endsWith('bundle.app'));
expect(iosApp.id, 'fooBundleId'); expect(iosApp.id, 'fooBundleId');
...@@ -361,8 +354,8 @@ void main() { ...@@ -361,8 +354,8 @@ void main() {
testUsingContext('returns null when there is no ios or .ios directory', () async { testUsingContext('returns null when there is no ios or .ios directory', () async {
globals.fs.file('pubspec.yaml').createSync(); globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
final BuildableIOSApp iosApp = await IOSApp.fromIosProject( final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp; FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
expect(iosApp, null); expect(iosApp, null);
}, overrides: overrides); }, overrides: overrides);
...@@ -371,8 +364,8 @@ void main() { ...@@ -371,8 +364,8 @@ void main() {
globals.fs.file('pubspec.yaml').createSync(); globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
globals.fs.file('ios/FooBar.xcodeproj').createSync(recursive: true); globals.fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
final BuildableIOSApp iosApp = await IOSApp.fromIosProject( final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp; FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
expect(iosApp, null); expect(iosApp, null);
}, overrides: overrides); }, overrides: overrides);
...@@ -381,8 +374,8 @@ void main() { ...@@ -381,8 +374,8 @@ void main() {
globals.fs.file('pubspec.yaml').createSync(); globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
globals.fs.file('ios/Runner.xcodeproj').createSync(recursive: true); globals.fs.file('ios/Runner.xcodeproj').createSync(recursive: true);
final BuildableIOSApp iosApp = await IOSApp.fromIosProject( final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp; FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
expect(iosApp, null); expect(iosApp, null);
}, overrides: overrides); }, overrides: overrides);
...@@ -392,8 +385,8 @@ void main() { ...@@ -392,8 +385,8 @@ void main() {
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
final Directory project = globals.fs.directory('ios/Runner.xcodeproj')..createSync(recursive: true); final Directory project = globals.fs.directory('ios/Runner.xcodeproj')..createSync(recursive: true);
project.childFile('project.pbxproj').createSync(); project.childFile('project.pbxproj').createSync();
final BuildableIOSApp iosApp = await IOSApp.fromIosProject( final BuildableIOSApp? iosApp = await IOSApp.fromIosProject(
FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp; FlutterProject.fromDirectory(globals.fs.currentDirectory).ios, null) as BuildableIOSApp?;
expect(iosApp, null); expect(iosApp, null);
}, overrides: overrides); }, overrides: overrides);
...@@ -407,8 +400,8 @@ void main() { ...@@ -407,8 +400,8 @@ void main() {
}; };
testUsingContext('Error on non-existing file', () { testUsingContext('Error on non-existing file', () {
final PrebuiltFuchsiaApp fuchsiaApp = final PrebuiltFuchsiaApp? fuchsiaApp =
FuchsiaApp.fromPrebuiltApp(globals.fs.file('not_existing.far')) as PrebuiltFuchsiaApp; FuchsiaApp.fromPrebuiltApp(globals.fs.file('not_existing.far')) as PrebuiltFuchsiaApp?;
expect(fuchsiaApp, isNull); expect(fuchsiaApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -418,8 +411,8 @@ void main() { ...@@ -418,8 +411,8 @@ void main() {
testUsingContext('Error on non-far file', () { testUsingContext('Error on non-far file', () {
globals.fs.directory('regular_folder').createSync(); globals.fs.directory('regular_folder').createSync();
final PrebuiltFuchsiaApp fuchsiaApp = final PrebuiltFuchsiaApp? fuchsiaApp =
FuchsiaApp.fromPrebuiltApp(globals.fs.file('regular_folder')) as PrebuiltFuchsiaApp; FuchsiaApp.fromPrebuiltApp(globals.fs.file('regular_folder')) as PrebuiltFuchsiaApp?;
expect(fuchsiaApp, isNull); expect(fuchsiaApp, isNull);
expect( expect(
testLogger.errorText, testLogger.errorText,
...@@ -429,7 +422,7 @@ void main() { ...@@ -429,7 +422,7 @@ void main() {
testUsingContext('Success with far file', () { testUsingContext('Success with far file', () {
globals.fs.file('bundle.far').createSync(); globals.fs.file('bundle.far').createSync();
final PrebuiltFuchsiaApp fuchsiaApp = FuchsiaApp.fromPrebuiltApp(globals.fs.file('bundle.far')) as PrebuiltFuchsiaApp; final PrebuiltFuchsiaApp fuchsiaApp = (FuchsiaApp.fromPrebuiltApp(globals.fs.file('bundle.far')) as PrebuiltFuchsiaApp?)!;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(fuchsiaApp.id, 'bundle.far'); expect(fuchsiaApp.id, 'bundle.far');
expect(fuchsiaApp.applicationPackage.path, globals.fs.file('bundle.far').path); expect(fuchsiaApp.applicationPackage.path, globals.fs.file('bundle.far').path);
...@@ -438,7 +431,7 @@ void main() { ...@@ -438,7 +431,7 @@ void main() {
testUsingContext('returns null when there is no fuchsia', () async { testUsingContext('returns null when there is no fuchsia', () async {
globals.fs.file('pubspec.yaml').createSync(); globals.fs.file('pubspec.yaml').createSync();
globals.fs.file('.packages').createSync(); globals.fs.file('.packages').createSync();
final BuildableFuchsiaApp fuchsiaApp = FuchsiaApp.fromFuchsiaProject(FlutterProject.fromDirectory(globals.fs.currentDirectory).fuchsia) as BuildableFuchsiaApp; final BuildableFuchsiaApp? fuchsiaApp = FuchsiaApp.fromFuchsiaProject(FlutterProject.fromDirectory(globals.fs.currentDirectory).fuchsia) as BuildableFuchsiaApp?;
expect(fuchsiaApp, null); expect(fuchsiaApp, null);
}, overrides: overrides); }, overrides: overrides);
...@@ -707,7 +700,7 @@ N: android=http://schemas.android.com/apk/res/android ...@@ -707,7 +700,7 @@ N: android=http://schemas.android.com/apk/res/android
'''; ''';
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils { class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
void Function(File, Directory) onUnzip; void Function(File, Directory)? onUnzip;
@override @override
void unzip(File file, Directory targetDirectory) { void unzip(File file, Directory targetDirectory) {
...@@ -717,16 +710,16 @@ class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils { ...@@ -717,16 +710,16 @@ class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
class FakeAndroidSdk extends Fake implements AndroidSdk { class FakeAndroidSdk extends Fake implements AndroidSdk {
@override @override
bool platformToolsAvailable; late bool platformToolsAvailable;
@override @override
bool licensesAvailable; late bool licensesAvailable;
@override @override
AndroidSdkVersion latestVersion; AndroidSdkVersion? latestVersion;
} }
class FakeAndroidSdkVersion extends Fake implements AndroidSdkVersion { class FakeAndroidSdkVersion extends Fake implements AndroidSdkVersion {
@override @override
String aaptPath; late String aaptPath;
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:args/command_runner.dart'; import 'package:args/command_runner.dart';
import 'package:flutter_tools/executable.dart' as executable; import 'package:flutter_tools/executable.dart' as executable;
...@@ -111,7 +109,7 @@ void main() { ...@@ -111,7 +109,7 @@ void main() {
}); });
} }
void verifyCommandRunner(CommandRunner<Object> runner) { void verifyCommandRunner(CommandRunner<Object?> runner) {
expect(runner.argParser, isNotNull, reason: '${runner.runtimeType} has no argParser'); expect(runner.argParser, isNotNull, reason: '${runner.runtimeType} has no argParser');
expect(runner.argParser.allowsAnything, isFalse, reason: '${runner.runtimeType} allows anything'); expect(runner.argParser.allowsAnything, isFalse, reason: '${runner.runtimeType} allows anything');
expect(runner.argParser.allowTrailingOptions, isFalse, reason: '${runner.runtimeType} allows trailing options'); expect(runner.argParser.allowTrailingOptions, isFalse, reason: '${runner.runtimeType} allows trailing options');
...@@ -119,7 +117,7 @@ void verifyCommandRunner(CommandRunner<Object> runner) { ...@@ -119,7 +117,7 @@ void verifyCommandRunner(CommandRunner<Object> runner) {
runner.commands.values.forEach(verifyCommand); runner.commands.values.forEach(verifyCommand);
} }
void verifyCommand(Command<Object> runner) { void verifyCommand(Command<Object?> runner) {
expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser'); expect(runner.argParser, isNotNull, reason: 'command ${runner.name} has no argParser');
verifyOptions(runner.name, runner.argParser.options.values); verifyOptions(runner.name, runner.argParser.options.values);
...@@ -161,7 +159,7 @@ const String _needHelp = "Every option must have help explaining what it does, e ...@@ -161,7 +159,7 @@ const String _needHelp = "Every option must have help explaining what it does, e
const String _header = ' Comment: '; const String _header = ' Comment: ';
void verifyOptions(String command, Iterable<Option> options) { void verifyOptions(String? command, Iterable<Option> options) {
String target; String target;
if (command == null) { if (command == null) {
target = 'the global argument "'; target = 'the global argument "';
...@@ -191,10 +189,11 @@ void verifyOptions(String command, Iterable<Option> options) { ...@@ -191,10 +189,11 @@ void verifyOptions(String command, Iterable<Option> options) {
if (option.defaultsTo != null) { if (option.defaultsTo != null) {
expect(option.help, isNot(contains('Default')), reason: '${_header}Help for $target--${option.name}" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).'); expect(option.help, isNot(contains('Default')), reason: '${_header}Help for $target--${option.name}" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).');
if (option.allowedHelp != null) { final Map<String, String>? allowedHelp = option.allowedHelp;
for (final String allowedValue in option.allowedHelp.keys) { if (allowedHelp != null) {
for (final String allowedValue in allowedHelp.keys) {
expect( expect(
option.allowedHelp[allowedValue], allowedHelp[allowedValue],
isNot(anyOf(contains('default'), contains('Default'))), isNot(anyOf(contains('default'), contains('Default'))),
reason: '${_header}Help for $target--${option.name} $allowedValue" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).', reason: '${_header}Help for $target--${option.name} $allowedValue" mentions the default value but that is redundant with the defaultsTo option which is also specified (and preferred).',
); );
...@@ -202,7 +201,7 @@ void verifyOptions(String command, Iterable<Option> options) { ...@@ -202,7 +201,7 @@ void verifyOptions(String command, Iterable<Option> options) {
} }
} }
expect(option.help, isNot(matches(_bannedArgumentReferencePatterns)), reason: '${_header}Help for $target--${option.name}" contains the string "--" in an unexpected way. If it\'s trying to mention another argument, it should be quoted, as in "--foo".'); expect(option.help, isNot(matches(_bannedArgumentReferencePatterns)), reason: '${_header}Help for $target--${option.name}" contains the string "--" in an unexpected way. If it\'s trying to mention another argument, it should be quoted, as in "--foo".');
for (final String line in option.help.split('\n')) { for (final String line in option.help!.split('\n')) {
if (!line.startsWith(' ')) { if (!line.startsWith(' ')) {
expect(line, isNot(contains(' ')), reason: '${_header}Help for $target--${option.name}" has excessive whitespace (check e.g. for double spaces after periods or round line breaks in the source).'); expect(line, isNot(contains(' ')), reason: '${_header}Help for $target--${option.name}" has excessive whitespace (check e.g. for double spaces after periods or round line breaks in the source).');
expect(line, matches(_allowedTrailingPatterns), reason: '${_header}A line in the help for $target--${option.name}" does not end with the expected period that a full sentence should end with. (If the help ends with a URL, place it after a colon, don\'t leave a trailing period; if it\'s sample code, prefix the line with four spaces.)'); expect(line, matches(_allowedTrailingPatterns), reason: '${_header}A line in the help for $target--${option.name}" does not end with the expected period that a full sentence should end with. (If the help ends with a URL, place it after a colon, don\'t leave a trailing period; if it\'s sample code, prefix the line with four spaces.)');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
...@@ -45,10 +45,10 @@ const FakeCommand kListEmulatorsCommand = FakeCommand( ...@@ -45,10 +45,10 @@ const FakeCommand kListEmulatorsCommand = FakeCommand(
); );
void main() { void main() {
FakeProcessManager fakeProcessManager; late FakeProcessManager fakeProcessManager;
FakeAndroidSdk sdk; late FakeAndroidSdk sdk;
FileSystem fileSystem; late FileSystem fileSystem;
Xcode xcode; late Xcode xcode;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
...@@ -110,7 +110,16 @@ void main() { ...@@ -110,7 +110,16 @@ void main() {
}); });
testWithoutContext('getEmulatorsById', () async { testWithoutContext('getEmulatorsById', () async {
final TestEmulatorManager testEmulatorManager = TestEmulatorManager(emulators); final TestEmulatorManager testEmulatorManager = TestEmulatorManager(emulators,
logger: BufferLogger.test(),
processManager: fakeProcessManager,
androidWorkflow: AndroidWorkflow(
androidSdk: sdk,
featureFlags: TestFeatureFlags(),
operatingSystemUtils: FakeOperatingSystemUtils(),
),
fileSystem: fileSystem,
);
expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5'), <Emulator>[emulator1]); expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5'), <Emulator>[emulator1]);
expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5X'), <Emulator>[emulator2]); expect(await testEmulatorManager.getEmulatorsMatching('Nexus_5X'), <Emulator>[emulator2]);
...@@ -340,7 +349,12 @@ void main() { ...@@ -340,7 +349,12 @@ void main() {
} }
class TestEmulatorManager extends EmulatorManager { class TestEmulatorManager extends EmulatorManager {
TestEmulatorManager(this.allEmulators); TestEmulatorManager(this.allEmulators, {
required super.logger,
required super.processManager,
required super.androidWorkflow,
required super.fileSystem,
});
final List<Emulator> allEmulators; final List<Emulator> allEmulators;
...@@ -374,16 +388,16 @@ class FakeEmulator extends Emulator { ...@@ -374,16 +388,16 @@ class FakeEmulator extends Emulator {
class FakeAndroidSdk extends Fake implements AndroidSdk { class FakeAndroidSdk extends Fake implements AndroidSdk {
@override @override
String avdManagerPath; String? avdManagerPath;
@override @override
String emulatorPath; String? emulatorPath;
@override @override
String adbPath; String? adbPath;
@override @override
String getAvdManagerPath() => avdManagerPath; String? getAvdManagerPath() => avdManagerPath;
@override @override
String getAvdPath() => 'avd'; String getAvdPath() => 'avd';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/application_package.dart'; import 'package:flutter_tools/src/application_package.dart';
...@@ -21,7 +21,6 @@ import 'package:flutter_tools/src/resident_devtools_handler.dart'; ...@@ -21,7 +21,6 @@ import 'package:flutter_tools/src/resident_devtools_handler.dart';
import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/run_hot.dart'; import 'package:flutter_tools/src/run_hot.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart'; import 'package:package_config/package_config.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import 'package:vm_service/vm_service.dart' as vm_service; import 'package:vm_service/vm_service.dart' as vm_service;
...@@ -116,8 +115,8 @@ void main() { ...@@ -116,8 +115,8 @@ void main() {
group('hotRestart', () { group('hotRestart', () {
final FakeResidentCompiler residentCompiler = FakeResidentCompiler(); final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
FileSystem fileSystem; late FileSystem fileSystem;
TestUsage testUsage; late TestUsage testUsage;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
...@@ -125,7 +124,7 @@ void main() { ...@@ -125,7 +124,7 @@ void main() {
}); });
group('fails to setup', () { group('fails to setup', () {
TestHotRunnerConfig failingTestingConfig; late TestHotRunnerConfig failingTestingConfig;
setUp(() { setUp(() {
failingTestingConfig = TestHotRunnerConfig( failingTestingConfig = TestHotRunnerConfig(
successfulHotRestartSetup: false, successfulHotRestartSetup: false,
...@@ -174,13 +173,13 @@ void main() { ...@@ -174,13 +173,13 @@ void main() {
target: 'main.dart', target: 'main.dart',
devtoolsHandler: createNoOpHandler, devtoolsHandler: createNoOpHandler,
reassembleHelper: ( reassembleHelper: (
List<FlutterDevice> flutterDevices, List<FlutterDevice?> flutterDevices,
Map<FlutterDevice, List<FlutterView>> viewCache, Map<FlutterDevice?, List<FlutterView>> viewCache,
void Function(String message) onSlow, void Function(String message)? onSlow,
String reloadMessage, String reloadMessage,
String fastReassembleClassName, String? fastReassembleClassName,
) async => ReassembleResult( ) async => ReassembleResult(
<FlutterView, FlutterVmService>{null: null}, <FlutterView?, FlutterVmService?>{null: null},
false, false,
true, true,
), ),
...@@ -198,7 +197,7 @@ void main() { ...@@ -198,7 +197,7 @@ void main() {
}); });
group('shutdown hook tests', () { group('shutdown hook tests', () {
TestHotRunnerConfig shutdownTestingConfig; late TestHotRunnerConfig shutdownTestingConfig;
setUp(() { setUp(() {
shutdownTestingConfig = TestHotRunnerConfig(); shutdownTestingConfig = TestHotRunnerConfig();
...@@ -250,7 +249,7 @@ void main() { ...@@ -250,7 +249,7 @@ void main() {
}); });
group('successful hot restart', () { group('successful hot restart', () {
TestHotRunnerConfig testingConfig; late TestHotRunnerConfig testingConfig;
setUp(() { setUp(() {
testingConfig = TestHotRunnerConfig( testingConfig = TestHotRunnerConfig(
successfulHotRestartSetup: true, successfulHotRestartSetup: true,
...@@ -279,7 +278,7 @@ void main() { ...@@ -279,7 +278,7 @@ void main() {
}, },
); );
(fakeFlutterDevice.devFS as FakeDevFs).baseUri = Uri.parse('file:///base_uri'); (fakeFlutterDevice.devFS! as FakeDevFs).baseUri = Uri.parse('file:///base_uri');
final OperationResult result = await HotRunner( final OperationResult result = await HotRunner(
devices, devices,
...@@ -318,7 +317,7 @@ void main() { ...@@ -318,7 +317,7 @@ void main() {
}); });
group('successful hot reload', () { group('successful hot reload', () {
TestHotRunnerConfig testingConfig; late TestHotRunnerConfig testingConfig;
setUp(() { setUp(() {
testingConfig = TestHotRunnerConfig( testingConfig = TestHotRunnerConfig(
successfulHotReloadSetup: true, successfulHotReloadSetup: true,
...@@ -349,7 +348,7 @@ void main() { ...@@ -349,7 +348,7 @@ void main() {
}, },
); );
(fakeFlutterDevice.devFS as FakeDevFs).baseUri = Uri.parse('file:///base_uri'); (fakeFlutterDevice.devFS! as FakeDevFs).baseUri = Uri.parse('file:///base_uri');
final OperationResult result = await HotRunner( final OperationResult result = await HotRunner(
devices, devices,
...@@ -359,13 +358,13 @@ void main() { ...@@ -359,13 +358,13 @@ void main() {
stopwatchFactory: fakeStopwatchFactory, stopwatchFactory: fakeStopwatchFactory,
reloadSourcesHelper: ( reloadSourcesHelper: (
HotRunner hotRunner, HotRunner hotRunner,
List<FlutterDevice> flutterDevices, List<FlutterDevice?> flutterDevices,
bool pause, bool? pause,
Map<String, dynamic> firstReloadDetails, Map<String, dynamic> firstReloadDetails,
String targetPlatform, String? targetPlatform,
String sdkName, String? sdkName,
bool emulator, bool? emulator,
String reason, String? reason,
) async { ) async {
firstReloadDetails['finalLibraryCount'] = 2; firstReloadDetails['finalLibraryCount'] = 2;
firstReloadDetails['receivedLibraryCount'] = 3; firstReloadDetails['receivedLibraryCount'] = 3;
...@@ -374,13 +373,13 @@ void main() { ...@@ -374,13 +373,13 @@ void main() {
return OperationResult.ok; return OperationResult.ok;
}, },
reassembleHelper: ( reassembleHelper: (
List<FlutterDevice> flutterDevices, List<FlutterDevice?> flutterDevices,
Map<FlutterDevice, List<FlutterView>> viewCache, Map<FlutterDevice?, List<FlutterView>> viewCache,
void Function(String message) onSlow, void Function(String message)? onSlow,
String reloadMessage, String reloadMessage,
String fastReassembleClassName, String? fastReassembleClassName,
) async => ReassembleResult( ) async => ReassembleResult(
<FlutterView, FlutterVmService>{null: null}, <FlutterView?, FlutterVmService?>{null: null},
false, false,
true, true,
), ),
...@@ -421,7 +420,7 @@ void main() { ...@@ -421,7 +420,7 @@ void main() {
}); });
group('hot restart that failed to sync dev fs', () { group('hot restart that failed to sync dev fs', () {
TestHotRunnerConfig testingConfig; late TestHotRunnerConfig testingConfig;
setUp(() { setUp(() {
testingConfig = TestHotRunnerConfig( testingConfig = TestHotRunnerConfig(
successfulHotRestartSetup: true, successfulHotRestartSetup: true,
...@@ -455,7 +454,7 @@ void main() { ...@@ -455,7 +454,7 @@ void main() {
}); });
group('hot reload that failed to sync dev fs', () { group('hot reload that failed to sync dev fs', () {
TestHotRunnerConfig testingConfig; late TestHotRunnerConfig testingConfig;
setUp(() { setUp(() {
testingConfig = TestHotRunnerConfig( testingConfig = TestHotRunnerConfig(
successfulHotReloadSetup: true, successfulHotReloadSetup: true,
...@@ -490,7 +489,7 @@ void main() { ...@@ -490,7 +489,7 @@ void main() {
}); });
group('hot attach', () { group('hot attach', () {
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
...@@ -561,10 +560,10 @@ class FakeDevFs extends Fake implements DevFS { ...@@ -561,10 +560,10 @@ class FakeDevFs extends Fake implements DevFS {
List<Uri> sources = <Uri>[]; List<Uri> sources = <Uri>[];
@override @override
DateTime lastCompiled; DateTime? lastCompiled;
@override @override
PackageConfig lastPackageConfig; PackageConfig? lastPackageConfig;
@override @override
Set<String> assetPathsToEvict = <String>{}; Set<String> assetPathsToEvict = <String>{};
...@@ -573,7 +572,7 @@ class FakeDevFs extends Fake implements DevFS { ...@@ -573,7 +572,7 @@ class FakeDevFs extends Fake implements DevFS {
Set<String> shaderPathsToEvict= <String>{}; Set<String> shaderPathsToEvict= <String>{};
@override @override
Uri baseUri; Uri? baseUri;
} }
// Unfortunately Device, despite not being immutable, has an `operator ==`. // Unfortunately Device, despite not being immutable, has an `operator ==`.
...@@ -608,8 +607,8 @@ class FakeDevice extends Fake implements Device { ...@@ -608,8 +607,8 @@ class FakeDevice extends Fake implements Device {
@override @override
Future<bool> stopApp( Future<bool> stopApp(
covariant ApplicationPackage app, { covariant ApplicationPackage? app, {
String userIdentifier, String? userIdentifier,
}) async { }) async {
return true; return true;
} }
...@@ -624,7 +623,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -624,7 +623,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
FakeFlutterDevice(this.device); FakeFlutterDevice(this.device);
bool stoppedEchoingDeviceLog = false; bool stoppedEchoingDeviceLog = false;
Future<UpdateFSReport> Function() updateDevFSReportCallback; late Future<UpdateFSReport> Function() updateDevFSReportCallback;
@override @override
final FakeDevice device; final FakeDevice device;
...@@ -635,36 +634,36 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -635,36 +634,36 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
} }
@override @override
DevFS devFS = FakeDevFs(); DevFS? devFS = FakeDevFs();
@override @override
FlutterVmService get vmService => FakeFlutterVmService(); FlutterVmService get vmService => FakeFlutterVmService();
@override @override
ResidentCompiler generator; ResidentCompiler? generator;
@override @override
Future<UpdateFSReport> updateDevFS({ Future<UpdateFSReport> updateDevFS({
Uri mainUri, Uri? mainUri,
String target, String? target,
AssetBundle bundle, AssetBundle? bundle,
DateTime firstBuildTime, DateTime? firstBuildTime,
bool bundleFirstUpload = false, bool bundleFirstUpload = false,
bool bundleDirty = false, bool bundleDirty = false,
bool fullRestart = false, bool fullRestart = false,
String projectRootPath, String? projectRootPath,
String pathToReload, String? pathToReload,
@required String dillOutputPath, required String dillOutputPath,
@required List<Uri> invalidatedFiles, required List<Uri> invalidatedFiles,
@required PackageConfig packageConfig, required PackageConfig packageConfig,
}) => updateDevFSReportCallback(); }) => updateDevFSReportCallback();
} }
class TestFlutterDevice extends FlutterDevice { class TestFlutterDevice extends FlutterDevice {
TestFlutterDevice({ TestFlutterDevice({
@required Device device, required Device device,
@required this.exception, required this.exception,
@required ResidentCompiler generator, required ResidentCompiler generator,
}) : assert(exception != null), }) : assert(exception != null),
super(device, buildInfo: BuildInfo.debug, generator: generator, developmentShaderCompiler: const FakeShaderCompiler()); super(device, buildInfo: BuildInfo.debug, generator: generator, developmentShaderCompiler: const FakeShaderCompiler());
...@@ -673,17 +672,17 @@ class TestFlutterDevice extends FlutterDevice { ...@@ -673,17 +672,17 @@ class TestFlutterDevice extends FlutterDevice {
@override @override
Future<void> connect({ Future<void> connect({
ReloadSources reloadSources, ReloadSources? reloadSources,
Restart restart, Restart? restart,
CompileExpression compileExpression, CompileExpression? compileExpression,
GetSkSLMethod getSkSLMethod, GetSkSLMethod? getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
bool disableServiceAuthCodes = false, bool disableServiceAuthCodes = false,
bool enableDds = true, bool enableDds = true,
bool cacheStartupProfile = false, bool cacheStartupProfile = false,
bool ipv6 = false, bool? ipv6 = false,
int hostVmServicePort, int? hostVmServicePort,
int ddsPort, int? ddsPort,
bool allowExistingDdsInstance = false, bool allowExistingDdsInstance = false,
}) async { }) async {
throw exception; throw exception;
...@@ -692,19 +691,19 @@ class TestFlutterDevice extends FlutterDevice { ...@@ -692,19 +691,19 @@ class TestFlutterDevice extends FlutterDevice {
class TestHotRunnerConfig extends HotRunnerConfig { class TestHotRunnerConfig extends HotRunnerConfig {
TestHotRunnerConfig({this.successfulHotRestartSetup, this.successfulHotReloadSetup}); TestHotRunnerConfig({this.successfulHotRestartSetup, this.successfulHotReloadSetup});
bool successfulHotRestartSetup; bool? successfulHotRestartSetup;
bool successfulHotReloadSetup; bool? successfulHotReloadSetup;
bool shutdownHookCalled = false; bool shutdownHookCalled = false;
bool updateDevFSCompleteCalled = false; bool updateDevFSCompleteCalled = false;
@override @override
Future<bool> setupHotRestart() async { Future<bool?> setupHotRestart() async {
assert(successfulHotRestartSetup != null, 'setupHotRestart is not expected to be called in this test.'); assert(successfulHotRestartSetup != null, 'setupHotRestart is not expected to be called in this test.');
return successfulHotRestartSetup; return successfulHotRestartSetup;
} }
@override @override
Future<bool> setupHotReload() async { Future<bool?> setupHotReload() async {
assert(successfulHotReloadSetup != null, 'setupHotReload is not expected to be called in this test.'); assert(successfulHotReloadSetup != null, 'setupHotReload is not expected to be called in this test.');
return successfulHotReloadSetup; return successfulHotReloadSetup;
} }
...@@ -749,7 +748,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler { ...@@ -749,7 +748,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler {
const FakeShaderCompiler(); const FakeShaderCompiler();
@override @override
void configureCompiler(TargetPlatform platform, { @required bool enableImpeller }) { } void configureCompiler(TargetPlatform? platform, { required bool enableImpeller }) { }
@override @override
Future<DevFSContent> recompileShader(DevFSContent inputShader) { Future<DevFSContent> recompileShader(DevFSContent inputShader) {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
...@@ -28,9 +26,9 @@ import '../src/context.dart'; ...@@ -28,9 +26,9 @@ import '../src/context.dart';
import '../src/test_build_system.dart'; import '../src/test_build_system.dart';
void main() { void main() {
FakeFlutterDevice mockFlutterDevice; late FakeFlutterDevice mockFlutterDevice;
FakeWebDevFS mockWebDevFS; late FakeWebDevFS mockWebDevFS;
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
...@@ -191,22 +189,22 @@ class FakeWebDevice extends Fake implements Device { ...@@ -191,22 +189,22 @@ class FakeWebDevice extends Fake implements Device {
@override @override
Future<bool> stopApp( Future<bool> stopApp(
covariant ApplicationPackage app, { covariant ApplicationPackage? app, {
String userIdentifier, String? userIdentifier,
}) async { }) async {
return true; return true;
} }
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
covariant ApplicationPackage package, { covariant ApplicationPackage? package, {
String mainPath, String? mainPath,
String route, String? route,
DebuggingOptions debuggingOptions, DebuggingOptions? debuggingOptions,
Map<String, dynamic> platformArgs, Map<String, dynamic>? platformArgs,
bool prebuiltApplication = false, bool prebuiltApplication = false,
bool ipv6 = false, bool ipv6 = false,
String userIdentifier, String? userIdentifier,
}) async { }) async {
return LaunchResult.succeeded(); return LaunchResult.succeeded();
} }
...@@ -219,14 +217,14 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -219,14 +217,14 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
final FakeWebDevice device; final FakeWebDevice device;
DevFS _devFS; DevFS? _devFS;
@override @override
DevFS get devFS => _devFS; DevFS? get devFS => _devFS;
@override @override
set devFS(DevFS value) { } set devFS(DevFS? value) { }
@override @override
FlutterVmService vmService; FlutterVmService? vmService;
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
...@@ -32,7 +30,6 @@ import 'package:flutter_tools/src/resident_runner.dart'; ...@@ -32,7 +30,6 @@ import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:flutter_tools/src/web/chrome.dart'; import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/web_device.dart'; import 'package:flutter_tools/src/web/web_device.dart';
import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart'; import 'package:package_config/package_config.dart';
import 'package:package_config/package_config_types.dart'; import 'package:package_config/package_config_types.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
...@@ -90,20 +87,20 @@ const List<VmServiceExpectation> kAttachExpectations = <VmServiceExpectation>[ ...@@ -90,20 +87,20 @@ const List<VmServiceExpectation> kAttachExpectations = <VmServiceExpectation>[
]; ];
void main() { void main() {
FakeDebugConnection debugConnection; late FakeDebugConnection debugConnection;
FakeChromeDevice chromeDevice; late FakeChromeDevice chromeDevice;
FakeAppConnection appConnection; late FakeAppConnection appConnection;
FakeFlutterDevice flutterDevice; late FakeFlutterDevice flutterDevice;
FakeWebDevFS webDevFS; late FakeWebDevFS webDevFS;
FakeResidentCompiler residentCompiler; late FakeResidentCompiler residentCompiler;
FakeChromeConnection chromeConnection; late FakeChromeConnection chromeConnection;
FakeChromeTab chromeTab; late FakeChromeTab chromeTab;
FakeWebServerDevice webServerDevice; late FakeWebServerDevice webServerDevice;
FakeDevice mockDevice; late FakeDevice mockDevice;
FakeVmServiceHost fakeVmServiceHost; late FakeVmServiceHost fakeVmServiceHost;
FileSystem fileSystem; late FileSystem fileSystem;
ProcessManager processManager; late ProcessManager processManager;
TestUsage testUsage; late TestUsage testUsage;
setUp(() { setUp(() {
testUsage = TestUsage(); testUsage = TestUsage();
...@@ -114,6 +111,7 @@ void main() { ...@@ -114,6 +111,7 @@ void main() {
appConnection = FakeAppConnection(); appConnection = FakeAppConnection();
webDevFS = FakeWebDevFS(); webDevFS = FakeWebDevFS();
residentCompiler = FakeResidentCompiler(); residentCompiler = FakeResidentCompiler();
chromeDevice = FakeChromeDevice();
chromeConnection = FakeChromeConnection(); chromeConnection = FakeChromeConnection();
chromeTab = FakeChromeTab('index.html'); chromeTab = FakeChromeTab('index.html');
webServerDevice = FakeWebServerDevice(); webServerDevice = FakeWebServerDevice();
...@@ -161,7 +159,7 @@ void main() { ...@@ -161,7 +159,7 @@ void main() {
expect(profileResidentWebRunner.debuggingEnabled, false); expect(profileResidentWebRunner.debuggingEnabled, false);
flutterDevice.device = FakeChromeDevice(); flutterDevice.device = chromeDevice;
expect(residentWebRunner.debuggingEnabled, true); expect(residentWebRunner.debuggingEnabled, true);
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
...@@ -897,7 +895,7 @@ void main() { ...@@ -897,7 +895,7 @@ void main() {
setupMocks(); setupMocks();
final Completer<DebugConnectionInfo> connectionInfoCompleter = final Completer<DebugConnectionInfo> connectionInfoCompleter =
Completer<DebugConnectionInfo>(); Completer<DebugConnectionInfo>();
final Future<int> result = residentWebRunner.run( final Future<int?> result = residentWebRunner.run(
connectionInfoCompleter: connectionInfoCompleter, connectionInfoCompleter: connectionInfoCompleter,
); );
await connectionInfoCompleter.future; await connectionInfoCompleter.future;
...@@ -1192,7 +1190,9 @@ flutter: ...@@ -1192,7 +1190,9 @@ flutter:
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
setupMocks(); setupMocks();
webDevFS.exception = ChromeDebugException(<String, dynamic>{}); webDevFS.exception = ChromeDebugException(<String, Object?>{
'text': 'error',
});
await expectLater(residentWebRunner.run, throwsToolExit()); await expectLater(residentWebRunner.run, throwsToolExit());
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
...@@ -1232,9 +1232,9 @@ flutter: ...@@ -1232,9 +1232,9 @@ flutter:
ResidentRunner setUpResidentRunner( ResidentRunner setUpResidentRunner(
FlutterDevice flutterDevice, { FlutterDevice flutterDevice, {
Logger logger, Logger? logger,
SystemClock systemClock, SystemClock? systemClock,
DebuggingOptions debuggingOptions, DebuggingOptions? debuggingOptions,
}) { }) {
return ResidentWebRunner( return ResidentWebRunner(
flutterDevice, flutterDevice,
...@@ -1261,7 +1261,7 @@ class FakeWebServerDevice extends FakeDevice implements WebServerDevice {} ...@@ -1261,7 +1261,7 @@ class FakeWebServerDevice extends FakeDevice implements WebServerDevice {}
// ignore: avoid_implementing_value_types // ignore: avoid_implementing_value_types
class FakeDevice extends Fake implements Device { class FakeDevice extends Fake implements Device {
@override @override
String name; String name = 'FakeDevice';
int count = 0; int count = 0;
...@@ -1269,26 +1269,26 @@ class FakeDevice extends Fake implements Device { ...@@ -1269,26 +1269,26 @@ class FakeDevice extends Fake implements Device {
Future<String> get sdkNameAndVersion async => 'SDK Name and Version'; Future<String> get sdkNameAndVersion async => 'SDK Name and Version';
@override @override
DartDevelopmentService dds; late DartDevelopmentService dds;
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
covariant ApplicationPackage package, { covariant ApplicationPackage? package, {
String mainPath, String? mainPath,
String route, String? route,
DebuggingOptions debuggingOptions, DebuggingOptions? debuggingOptions,
Map<String, dynamic> platformArgs, Map<String, dynamic>? platformArgs,
bool prebuiltApplication = false, bool prebuiltApplication = false,
bool ipv6 = false, bool ipv6 = false,
String userIdentifier, String? userIdentifier,
}) async { }) async {
return LaunchResult.succeeded(); return LaunchResult.succeeded();
} }
@override @override
Future<bool> stopApp( Future<bool> stopApp(
covariant ApplicationPackage app, { covariant ApplicationPackage? app, {
String userIdentifier, String? userIdentifier,
}) async { }) async {
if (count > 0) { if (count > 0) {
throw StateError('stopApp called more than once.'); throw StateError('stopApp called more than once.');
...@@ -1299,14 +1299,14 @@ class FakeDevice extends Fake implements Device { ...@@ -1299,14 +1299,14 @@ class FakeDevice extends Fake implements Device {
} }
class FakeDebugConnection extends Fake implements DebugConnection { class FakeDebugConnection extends Fake implements DebugConnection {
FakeVmServiceHost Function() fakeVmServiceHost; late FakeVmServiceHost Function() fakeVmServiceHost;
@override @override
vm_service.VmService get vmService => vm_service.VmService get vmService =>
fakeVmServiceHost.call().vmService.service; fakeVmServiceHost.call().vmService.service;
@override @override
String uri; late String uri;
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
bool didClose = false; bool didClose = false;
...@@ -1340,14 +1340,14 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler { ...@@ -1340,14 +1340,14 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
@override @override
Future<CompilerOutput> recompile( Future<CompilerOutput> recompile(
Uri mainUri, Uri mainUri,
List<Uri> invalidatedFiles, { List<Uri>? invalidatedFiles, {
@required String outputPath, required String outputPath,
@required PackageConfig packageConfig, required PackageConfig packageConfig,
@required String projectRootPath, required FileSystem fs,
@required FileSystem fs, String? projectRootPath,
bool suppressErrors = false, bool suppressErrors = false,
bool checkDartPluginRegistry = false, bool checkDartPluginRegistry = false,
File dartPluginRegistrant, File? dartPluginRegistrant,
}) async { }) async {
return const CompilerOutput('foo.dill', 0, <Uri>[]); return const CompilerOutput('foo.dill', 0, <Uri>[]);
} }
...@@ -1368,11 +1368,11 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler { ...@@ -1368,11 +1368,11 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
} }
class FakeWebDevFS extends Fake implements WebDevFS { class FakeWebDevFS extends Fake implements WebDevFS {
Object exception; Object? exception;
ConnectionResult result; ConnectionResult? result;
UpdateFSReport report; late UpdateFSReport report;
Uri mainUri; Uri? mainUri;
@override @override
List<Uri> sources = <Uri>[]; List<Uri> sources = <Uri>[];
...@@ -1381,10 +1381,10 @@ class FakeWebDevFS extends Fake implements WebDevFS { ...@@ -1381,10 +1381,10 @@ class FakeWebDevFS extends Fake implements WebDevFS {
Uri baseUri = Uri.parse('http://localhost:12345'); Uri baseUri = Uri.parse('http://localhost:12345');
@override @override
DateTime lastCompiled = DateTime.now(); DateTime? lastCompiled = DateTime.now();
@override @override
PackageConfig lastPackageConfig = PackageConfig.empty; PackageConfig? lastPackageConfig = PackageConfig.empty;
@override @override
Future<Uri> create() async { Future<Uri> create() async {
...@@ -1393,33 +1393,33 @@ class FakeWebDevFS extends Fake implements WebDevFS { ...@@ -1393,33 +1393,33 @@ class FakeWebDevFS extends Fake implements WebDevFS {
@override @override
Future<UpdateFSReport> update({ Future<UpdateFSReport> update({
@required Uri mainUri, required Uri mainUri,
@required ResidentCompiler generator, required ResidentCompiler generator,
@required bool trackWidgetCreation, required bool trackWidgetCreation,
@required String pathToReload, required String pathToReload,
@required List<Uri> invalidatedFiles, required List<Uri> invalidatedFiles,
@required PackageConfig packageConfig, required PackageConfig packageConfig,
@required String dillOutputPath, required String dillOutputPath,
@required DevelopmentShaderCompiler shaderCompiler, required DevelopmentShaderCompiler shaderCompiler,
DevFSWriter devFSWriter, DevFSWriter? devFSWriter,
String target, String? target,
AssetBundle bundle, AssetBundle? bundle,
DateTime firstBuildTime, DateTime? firstBuildTime,
bool bundleFirstUpload = false, bool bundleFirstUpload = false,
bool fullRestart = false, bool fullRestart = false,
String projectRootPath, String? projectRootPath,
File dartPluginRegistrant, File? dartPluginRegistrant,
}) async { }) async {
this.mainUri = mainUri; this.mainUri = mainUri;
return report; return report;
} }
@override @override
Future<ConnectionResult> connect(bool useDebugExtension, {VmServiceFactory vmServiceFactory = createVmServiceDelegate}) async { Future<ConnectionResult?> connect(bool useDebugExtension, {VmServiceFactory vmServiceFactory = createVmServiceDelegate}) async {
if (exception != null) { if (exception != null) {
assert(exception is Exception || exception is Error); assert(exception is Exception || exception is Error);
// ignore: only_throw_errors, exception is either Error or Exception here. // ignore: only_throw_errors, exception is either Error or Exception here.
throw exception; throw exception!;
} }
return result; return result;
} }
...@@ -1430,12 +1430,12 @@ class FakeChromeConnection extends Fake implements ChromeConnection { ...@@ -1430,12 +1430,12 @@ class FakeChromeConnection extends Fake implements ChromeConnection {
@override @override
Future<ChromeTab> getTab(bool Function(ChromeTab tab) accept, Future<ChromeTab> getTab(bool Function(ChromeTab tab) accept,
{Duration retryFor}) async { {Duration? retryFor}) async {
return tabs.firstWhere(accept); return tabs.firstWhere(accept);
} }
@override @override
Future<List<ChromeTab>> getTabs({Duration retryFor}) async { Future<List<ChromeTab>> getTabs({Duration? retryFor}) async {
return tabs; return tabs;
} }
} }
...@@ -1448,7 +1448,7 @@ class FakeChromeTab extends Fake implements ChromeTab { ...@@ -1448,7 +1448,7 @@ class FakeChromeTab extends Fake implements ChromeTab {
final FakeWipConnection connection = FakeWipConnection(); final FakeWipConnection connection = FakeWipConnection();
@override @override
Future<WipConnection> connect({Function/*?*/ onError}) async { Future<WipConnection> connect({Function? onError}) async {
return connection; return connection;
} }
} }
...@@ -1491,9 +1491,9 @@ class TestChromiumLauncher implements ChromiumLauncher { ...@@ -1491,9 +1491,9 @@ class TestChromiumLauncher implements ChromiumLauncher {
Future<Chromium> launch( Future<Chromium> launch(
String url, { String url, {
bool headless = false, bool headless = false,
int debugPort, int? debugPort,
bool skipCheck = false, bool skipCheck = false,
Directory cacheDir, Directory? cacheDir,
List<String> webBrowserFlags = const <String>[], List<String> webBrowserFlags = const <String>[],
}) async { }) async {
return currentCompleter.future; return currentCompleter.future;
...@@ -1506,35 +1506,35 @@ class TestChromiumLauncher implements ChromiumLauncher { ...@@ -1506,35 +1506,35 @@ class TestChromiumLauncher implements ChromiumLauncher {
} }
class FakeFlutterDevice extends Fake implements FlutterDevice { class FakeFlutterDevice extends Fake implements FlutterDevice {
Uri testUri; Uri? testUri;
UpdateFSReport report = UpdateFSReport( UpdateFSReport report = UpdateFSReport(
success: true, success: true,
invalidatedSourcesCount: 1, invalidatedSourcesCount: 1,
); );
Exception reportError; Exception? reportError;
@override @override
ResidentCompiler generator; ResidentCompiler? generator;
@override @override
Stream<Uri> get observatoryUris => Stream<Uri>.value(testUri); Stream<Uri?> get observatoryUris => Stream<Uri?>.value(testUri);
@override @override
DevelopmentShaderCompiler get developmentShaderCompiler => const FakeShaderCompiler(); DevelopmentShaderCompiler get developmentShaderCompiler => const FakeShaderCompiler();
@override @override
FlutterVmService vmService; FlutterVmService? vmService;
DevFS _devFS; DevFS? _devFS;
@override @override
DevFS get devFS => _devFS; DevFS? get devFS => _devFS;
@override @override
set devFS(DevFS value) {} set devFS(DevFS? value) {}
@override @override
Device device; Device? device;
@override @override
Future<void> stopEchoingDeviceLog() async {} Future<void> stopEchoingDeviceLog() async {}
...@@ -1543,7 +1543,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -1543,7 +1543,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
Future<void> initLogReader() async {} Future<void> initLogReader() async {}
@override @override
Future<Uri> setupDevFS(String fsName, Directory rootDirectory) async { Future<Uri?> setupDevFS(String fsName, Directory rootDirectory) async {
return testUri; return testUri;
} }
...@@ -1553,38 +1553,38 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { ...@@ -1553,38 +1553,38 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
@override @override
Future<void> connect({ Future<void> connect({
ReloadSources reloadSources, ReloadSources? reloadSources,
Restart restart, Restart? restart,
CompileExpression compileExpression, CompileExpression? compileExpression,
GetSkSLMethod getSkSLMethod, GetSkSLMethod? getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
int hostVmServicePort, int? hostVmServicePort,
int ddsPort, int? ddsPort,
bool disableServiceAuthCodes = false, bool disableServiceAuthCodes = false,
bool enableDds = true, bool enableDds = true,
bool cacheStartupProfile = false, bool cacheStartupProfile = false,
@required bool allowExistingDdsInstance, required bool allowExistingDdsInstance,
bool ipv6 = false, bool? ipv6 = false,
}) async {} }) async {}
@override @override
Future<UpdateFSReport> updateDevFS({ Future<UpdateFSReport> updateDevFS({
Uri mainUri, Uri? mainUri,
String target, String? target,
AssetBundle bundle, AssetBundle? bundle,
DateTime firstBuildTime, DateTime? firstBuildTime,
bool bundleFirstUpload = false, bool bundleFirstUpload = false,
bool bundleDirty = false, bool bundleDirty = false,
bool fullRestart = false, bool fullRestart = false,
String projectRootPath, String? projectRootPath,
String pathToReload, String? pathToReload,
String dillOutputPath, String? dillOutputPath,
List<Uri> invalidatedFiles, List<Uri>? invalidatedFiles,
PackageConfig packageConfig, PackageConfig? packageConfig,
File dartPluginRegistrant, File? dartPluginRegistrant,
}) async { }) async {
if (reportError != null) { if (reportError != null) {
throw reportError; throw reportError!;
} }
return report; return report;
} }
...@@ -1597,7 +1597,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler { ...@@ -1597,7 +1597,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler {
const FakeShaderCompiler(); const FakeShaderCompiler();
@override @override
void configureCompiler(TargetPlatform platform, { @required bool enableImpeller }) { } void configureCompiler(TargetPlatform? platform, { required bool enableImpeller }) { }
@override @override
Future<DevFSContent> recompileShader(DevFSContent inputShader) { Future<DevFSContent> recompileShader(DevFSContent inputShader) {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:fake_async/fake_async.dart'; import 'package:fake_async/fake_async.dart';
...@@ -62,7 +60,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest( ...@@ -62,7 +60,7 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
void main() { void main() {
testWithoutContext('VmService registers reloadSources', () async { testWithoutContext('VmService registers reloadSources', () async {
Future<void> reloadSources(String isolateId, { bool pause, bool force}) async {} Future<void> reloadSources(String isolateId, { bool? pause, bool? force}) async {}
final MockVMService mockVMService = MockVMService(); final MockVMService mockVMService = MockVMService();
await setUpVmService( await setUpVmService(
...@@ -217,7 +215,7 @@ void main() { ...@@ -217,7 +215,7 @@ void main() {
windows: false, windows: false,
)); ));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>; final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[ expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod), containsPair('method', kSetAssetBundlePathMethod),
...@@ -245,7 +243,7 @@ void main() { ...@@ -245,7 +243,7 @@ void main() {
windows: true, windows: true,
)); ));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>; final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[ expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod), containsPair('method', kSetAssetBundlePathMethod),
...@@ -269,7 +267,7 @@ void main() { ...@@ -269,7 +267,7 @@ void main() {
viewId: 'abc', viewId: 'abc',
)); ));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>; final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[ expect(rawRequest, allOf(<Matcher>[
containsPair('method', kGetSkSLsMethod), containsPair('method', kGetSkSLsMethod),
...@@ -291,7 +289,7 @@ void main() { ...@@ -291,7 +289,7 @@ void main() {
uiIsolateId: 'def', uiIsolateId: 'def',
)); ));
final Map<String, Object> rawRequest = json.decode(await completer.future) as Map<String, Object>; final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[ expect(rawRequest, allOf(<Matcher>[
containsPair('method', kFlushUIThreadTasksMethod), containsPair('method', kFlushUIThreadTasksMethod),
...@@ -469,7 +467,7 @@ void main() { ...@@ -469,7 +467,7 @@ void main() {
] ]
); );
final Map<String, Object> skSLs = await fakeVmServiceHost.vmService.getSkSLs( final Map<String, Object?>? skSLs = await fakeVmServiceHost.vmService.getSkSLs(
viewId: '1234', viewId: '1234',
); );
expect(skSLs, isNull); expect(skSLs, isNull);
...@@ -477,19 +475,19 @@ void main() { ...@@ -477,19 +475,19 @@ void main() {
final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews(); final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews();
expect(views, isEmpty); expect(views, isEmpty);
final vm_service.Response screenshot = await fakeVmServiceHost.vmService.screenshot(); final vm_service.Response? screenshot = await fakeVmServiceHost.vmService.screenshot();
expect(screenshot, isNull); expect(screenshot, isNull);
final vm_service.Response screenshotSkp = await fakeVmServiceHost.vmService.screenshotSkp(); final vm_service.Response? screenshotSkp = await fakeVmServiceHost.vmService.screenshotSkp();
expect(screenshotSkp, isNull); expect(screenshotSkp, isNull);
// Checking that this doesn't throw. // Checking that this doesn't throw.
await fakeVmServiceHost.vmService.setTimelineFlags(<String>['test']); await fakeVmServiceHost.vmService.setTimelineFlags(<String>['test']);
final vm_service.Response timeline = await fakeVmServiceHost.vmService.getTimeline(); final vm_service.Response? timeline = await fakeVmServiceHost.vmService.getTimeline();
expect(timeline, isNull); expect(timeline, isNull);
final Map<String, Object> rasterStats = final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: '1', uiIsolateId: '12'); await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: '1', uiIsolateId: '12');
expect(rasterStats, isNull); expect(rasterStats, isNull);
...@@ -505,7 +503,7 @@ void main() { ...@@ -505,7 +503,7 @@ void main() {
] ]
); );
final vm_service.Isolate isolate = await fakeVmServiceHost.vmService.getIsolateOrNull( final vm_service.Isolate? isolate = await fakeVmServiceHost.vmService.getIsolateOrNull(
'isolate/123', 'isolate/123',
); );
expect(isolate, null); expect(isolate, null);
...@@ -535,7 +533,7 @@ void main() { ...@@ -535,7 +533,7 @@ void main() {
] ]
); );
final Map<String, Object> rasterStats = final Map<String, Object?>? rasterStats =
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: 'view/1', uiIsolateId: 'isolate/123'); await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: 'view/1', uiIsolateId: 'isolate/123');
expect(rasterStats, equals(response)); expect(rasterStats, equals(response));
...@@ -629,7 +627,7 @@ void main() { ...@@ -629,7 +627,7 @@ void main() {
isolate.toJson() isolate.toJson()
..['id'] = '2' ..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName], ..['extensionRPCs'] = <String>[otherExtensionName],
); )!;
final FlutterView fakeFlutterView2 = FlutterView( final FlutterView fakeFlutterView2 = FlutterView(
id: '2', id: '2',
...@@ -680,7 +678,7 @@ void main() { ...@@ -680,7 +678,7 @@ void main() {
testWithoutContext('does not rethrow a sentinel exception if the initially queried flutter view disappears', () async { testWithoutContext('does not rethrow a sentinel exception if the initially queried flutter view disappears', () async {
const String otherExtensionName = 'ext.flutter.test.otherExtension'; const String otherExtensionName = 'ext.flutter.test.otherExtension';
final vm_service.Isolate isolate2 = vm_service.Isolate.parse( final vm_service.Isolate? isolate2 = vm_service.Isolate.parse(
isolate.toJson() isolate.toJson()
..['id'] = '2' ..['id'] = '2'
..['extensionRPCs'] = <String>[otherExtensionName], ..['extensionRPCs'] = <String>[otherExtensionName],
...@@ -836,7 +834,7 @@ void main() { ...@@ -836,7 +834,7 @@ void main() {
testUsingContext('WebSocket URL construction uses correct URI join primitives', () async { testUsingContext('WebSocket URL construction uses correct URI join primitives', () async {
final Completer<String> completer = Completer<String>(); final Completer<String> completer = Completer<String>();
openChannelForTesting = (String url, {io.CompressionOptions compression, Logger logger}) async { openChannelForTesting = (String url, {io.CompressionOptions compression = io.CompressionOptions.compressionDefault, required Logger logger}) async {
completer.complete(url); completer.complete(url);
throw Exception(''); throw Exception('');
}; };
...@@ -883,8 +881,8 @@ class FakeDevice extends Fake implements Device { } ...@@ -883,8 +881,8 @@ class FakeDevice extends Fake implements Device { }
/// A [WebSocketConnector] that always throws an [io.SocketException]. /// A [WebSocketConnector] that always throws an [io.SocketException].
Future<io.WebSocket> failingWebSocketConnector( Future<io.WebSocket> failingWebSocketConnector(
String url, { String url, {
io.CompressionOptions compression, io.CompressionOptions? compression,
Logger logger, Logger? logger,
}) { }) {
throw const io.SocketException('Failed WebSocket connection'); throw const io.SocketException('Failed WebSocket connection');
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:io' hide Directory, File; import 'dart:io' hide Directory, File;
...@@ -23,7 +21,6 @@ import 'package:flutter_tools/src/globals.dart' as globals; ...@@ -23,7 +21,6 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/isolated/devfs_web.dart'; import 'package:flutter_tools/src/isolated/devfs_web.dart';
import 'package:flutter_tools/src/web/compile.dart'; import 'package:flutter_tools/src/web/compile.dart';
import 'package:logging/logging.dart' as logging; import 'package:logging/logging.dart' as logging;
import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart'; import 'package:package_config/package_config.dart';
import 'package:shelf/shelf.dart'; import 'package:shelf/shelf.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
...@@ -41,14 +38,14 @@ const List<int> kTransparentImage = <int>[ ...@@ -41,14 +38,14 @@ const List<int> kTransparentImage = <int>[
]; ];
void main() { void main() {
Testbed testbed; late Testbed testbed;
WebAssetServer webAssetServer; late WebAssetServer webAssetServer;
ReleaseAssetServer releaseAssetServer; late ReleaseAssetServer releaseAssetServer;
Platform linux; late Platform linux;
PackageConfig packages; late PackageConfig packages;
Platform windows; late Platform windows;
FakeHttpServer httpServer; late FakeHttpServer httpServer;
BufferLogger logger; late BufferLogger logger;
setUpAll(() async { setUpAll(() async {
packages = PackageConfig(<Package>[ packages = PackageConfig(<Package>[
...@@ -66,15 +63,15 @@ void main() { ...@@ -66,15 +63,15 @@ void main() {
httpServer, httpServer,
packages, packages,
InternetAddress.loopbackIPv4, InternetAddress.loopbackIPv4,
null, <String, String>{},
null, <String, String>{},
null, NullSafetyMode.unsound,
); );
releaseAssetServer = ReleaseAssetServer( releaseAssetServer = ReleaseAssetServer(
globals.fs.file('main.dart').uri, globals.fs.file('main.dart').uri,
fileSystem: null, // ignore: avoid_redundant_argument_values fileSystem: globals.fs,
flutterRoot: null, // ignore: avoid_redundant_argument_values flutterRoot: null, // ignore: avoid_redundant_argument_values
platform: null, // ignore: avoid_redundant_argument_values platform: FakePlatform(),
webBuildDirectory: null, // ignore: avoid_redundant_argument_values webBuildDirectory: null, // ignore: avoid_redundant_argument_values
basePath: null, basePath: null,
); );
...@@ -183,10 +180,10 @@ void main() { ...@@ -183,10 +180,10 @@ void main() {
})); }));
webAssetServer.write(source, manifest, sourcemap, metadata); webAssetServer.write(source, manifest, sourcemap, metadata);
final String merged = await webAssetServer.metadataContents('main_module.ddc_merged_metadata'); final String? merged = await webAssetServer.metadataContents('main_module.ddc_merged_metadata');
expect(merged, equals(metadataContents)); expect(merged, equals(metadataContents));
final String single = await webAssetServer.metadataContents('foo.js.metadata'); final String? single = await webAssetServer.metadataContents('foo.js.metadata');
expect(single, equals(metadataContents)); expect(single, equals(metadataContents));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => linux, Platform: () => linux,
...@@ -292,9 +289,9 @@ void main() { ...@@ -292,9 +289,9 @@ void main() {
httpServer, httpServer,
packages, packages,
InternetAddress.loopbackIPv4, InternetAddress.loopbackIPv4,
null, <String, String>{},
null, <String, String>{},
null, NullSafetyMode.unsound,
); );
expect(webAssetServer.basePath, 'foo/bar'); expect(webAssetServer.basePath, 'foo/bar');
...@@ -311,9 +308,9 @@ void main() { ...@@ -311,9 +308,9 @@ void main() {
httpServer, httpServer,
packages, packages,
InternetAddress.loopbackIPv4, InternetAddress.loopbackIPv4,
null, <String, String>{},
null, <String, String>{},
null, NullSafetyMode.unsound,
); );
// Defaults to "/" when there's no base element. // Defaults to "/" when there's no base element.
...@@ -332,9 +329,9 @@ void main() { ...@@ -332,9 +329,9 @@ void main() {
httpServer, httpServer,
packages, packages,
InternetAddress.loopbackIPv4, InternetAddress.loopbackIPv4,
null, <String, String>{},
null, <String, String>{},
null, NullSafetyMode.unsound,
), ),
throwsToolExit(), throwsToolExit(),
); );
...@@ -352,9 +349,9 @@ void main() { ...@@ -352,9 +349,9 @@ void main() {
httpServer, httpServer,
packages, packages,
InternetAddress.loopbackIPv4, InternetAddress.loopbackIPv4,
null, <String, String>{},
null, <String, String>{},
null, NullSafetyMode.unsound,
), ),
throwsToolExit(), throwsToolExit(),
); );
...@@ -380,7 +377,7 @@ void main() { ...@@ -380,7 +377,7 @@ void main() {
final Response response = await webAssetServer final Response response = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/foo.js'))); .handleRequest(Request('GET', Uri.parse('http://foobar/foo.js')));
final String etag = response.headers[HttpHeaders.etagHeader]; final String etag = response.headers[HttpHeaders.etagHeader]!;
final Response cachedResponse = await webAssetServer final Response cachedResponse = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/foo.js'), headers: <String, String>{ .handleRequest(Request('GET', Uri.parse('http://foobar/foo.js'), headers: <String, String>{
...@@ -622,14 +619,14 @@ void main() { ...@@ -622,14 +619,14 @@ void main() {
final Response response = await webAssetServer final Response response = await webAssetServer
.handleRequest(Request('GET', Uri.parse('http://foobar/assets/fooπ'))); .handleRequest(Request('GET', Uri.parse('http://foobar/assets/fooπ')));
final String etag = response.headers[HttpHeaders.etagHeader]; final String etag = response.headers[HttpHeaders.etagHeader]!;
expect(etag.runes, everyElement(predicate((int char) => char < 255))); expect(etag.runes, everyElement(predicate((int char) => char < 255)));
})); }));
test('serves /packages/<package>/<path> files as if they were ' test('serves /packages/<package>/<path> files as if they were '
'package:<package>/<path> uris', () => testbed.run(() async { 'package:<package>/<path> uris', () => testbed.run(() async {
final Uri expectedUri = packages.resolve( final Uri? expectedUri = packages.resolve(
Uri.parse('package:flutter_tools/foo.dart')); Uri.parse('package:flutter_tools/foo.dart'));
final File source = globals.fs.file(globals.fs.path.fromUri(expectedUri)) final File source = globals.fs.file(globals.fs.path.fromUri(expectedUri))
..createSync(recursive: true) ..createSync(recursive: true)
...@@ -691,13 +688,13 @@ void main() { ...@@ -691,13 +688,13 @@ void main() {
final Uri uri = await webDevFS.create(); final Uri uri = await webDevFS.create();
webDevFS.webAssetServer.entrypointCacheDirectory = globals.fs.currentDirectory; webDevFS.webAssetServer.entrypointCacheDirectory = globals.fs.currentDirectory;
final String webPrecompiledSdk = globals.artifacts final String webPrecompiledSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSdk).path; .getHostArtifact(HostArtifact.webPrecompiledSdk).path;
final String webPrecompiledSdkSourcemaps = globals.artifacts final String webPrecompiledSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSdkSourcemaps).path; .getHostArtifact(HostArtifact.webPrecompiledSdkSourcemaps).path;
final String webPrecompiledCanvaskitSdk = globals.artifacts final String webPrecompiledCanvaskitSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdk).path; .getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdk).path;
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdkSourcemaps).path; .getHostArtifact(HostArtifact.webPrecompiledCanvaskitSdkSourcemaps).path;
globals.fs.currentDirectory globals.fs.currentDirectory
.childDirectory('lib') .childDirectory('lib')
...@@ -808,13 +805,13 @@ void main() { ...@@ -808,13 +805,13 @@ void main() {
.childFile('web_entrypoint.dart') .childFile('web_entrypoint.dart')
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('GENERATED'); ..writeAsStringSync('GENERATED');
final String webPrecompiledSdk = globals.artifacts final String webPrecompiledSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path; .getHostArtifact(HostArtifact.webPrecompiledSoundSdk).path;
final String webPrecompiledSdkSourcemaps = globals.artifacts final String webPrecompiledSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledSoundSdkSourcemaps).path; .getHostArtifact(HostArtifact.webPrecompiledSoundSdkSourcemaps).path;
final String webPrecompiledCanvaskitSdk = globals.artifacts final String webPrecompiledCanvaskitSdk = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdk).path; .getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdk).path;
final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts final String webPrecompiledCanvaskitSdkSourcemaps = globals.artifacts!
.getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps).path; .getHostArtifact(HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps).path;
globals.fs.file(webPrecompiledSdk) globals.fs.file(webPrecompiledSdk)
..createSync(recursive: true) ..createSync(recursive: true)
...@@ -917,7 +914,7 @@ void main() { ...@@ -917,7 +914,7 @@ void main() {
webDevFS.webAssetServer.dwds = FakeDwds(<AppConnection>[firstConnection, secondConnection]); webDevFS.webAssetServer.dwds = FakeDwds(<AppConnection>[firstConnection, secondConnection]);
int vmServiceFactoryInvocationCount = 0; int vmServiceFactoryInvocationCount = 0;
Future<vm_service.VmService> vmServiceFactory(Uri uri, {CompressionOptions compression, @required Logger logger}) { Future<vm_service.VmService> vmServiceFactory(Uri uri, {CompressionOptions? compression, required Logger logger}) {
if (vmServiceFactoryInvocationCount > 0) { if (vmServiceFactoryInvocationCount > 0) {
fail('Called vmServiceFactory twice!'); fail('Called vmServiceFactory twice!');
} }
...@@ -927,7 +924,7 @@ void main() { ...@@ -927,7 +924,7 @@ void main() {
() => FakeVmService(), () => FakeVmService(),
); );
} }
return webDevFS.connect(false, vmServiceFactory: vmServiceFactory).then<void>((ConnectionResult firstConnectionResult) { return webDevFS.connect(false, vmServiceFactory: vmServiceFactory).then<void>((ConnectionResult? firstConnectionResult) {
return webDevFS.destroy(); return webDevFS.destroy();
}); });
}); });
...@@ -1078,7 +1075,7 @@ void main() { ...@@ -1078,7 +1075,7 @@ void main() {
false, false,
Uri.base, Uri.base,
null, null,
null, NullSafetyMode.unsound,
testMode: true); testMode: true);
expect(webAssetServer.defaultResponseHeaders['x-frame-options'], null); expect(webAssetServer.defaultResponseHeaders['x-frame-options'], null);
...@@ -1179,20 +1176,20 @@ class FakeHttpServer extends Fake implements HttpServer { ...@@ -1179,20 +1176,20 @@ class FakeHttpServer extends Fake implements HttpServer {
} }
class FakeResidentCompiler extends Fake implements ResidentCompiler { class FakeResidentCompiler extends Fake implements ResidentCompiler {
CompilerOutput output; CompilerOutput? output;
@override @override
void addFileSystemRoot(String root) { } void addFileSystemRoot(String root) { }
@override @override
Future<CompilerOutput> recompile(Uri mainUri, List<Uri> invalidatedFiles, { Future<CompilerOutput?> recompile(Uri mainUri, List<Uri>? invalidatedFiles, {
String outputPath, String? outputPath,
PackageConfig packageConfig, PackageConfig? packageConfig,
String projectRootPath, String? projectRootPath,
FileSystem fs, FileSystem? fs,
bool suppressErrors = false, bool suppressErrors = false,
bool checkDartPluginRegistry = false, bool checkDartPluginRegistry = false,
File dartPluginRegistrant, File? dartPluginRegistrant,
}) async { }) async {
return output; return output;
} }
...@@ -1202,7 +1199,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler { ...@@ -1202,7 +1199,7 @@ class FakeShaderCompiler implements DevelopmentShaderCompiler {
const FakeShaderCompiler(); const FakeShaderCompiler();
@override @override
void configureCompiler(TargetPlatform platform, { @required bool enableImpeller }) { } void configureCompiler(TargetPlatform? platform, { required bool enableImpeller }) { }
@override @override
Future<DevFSContent> recompileShader(DevFSContent inputShader) { Future<DevFSContent> recompileShader(DevFSContent inputShader) {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:convert'; import 'dart:convert';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
...@@ -16,11 +14,11 @@ import '../../src/fakes.dart'; ...@@ -16,11 +14,11 @@ import '../../src/fakes.dart';
void main() { void main() {
group('Test that TestGoldenComparatorProcess', () { group('Test that TestGoldenComparatorProcess', () {
File imageFile; late File imageFile;
Uri goldenKey; late Uri goldenKey;
File imageFile2; late File imageFile2;
Uri goldenKey2; late Uri goldenKey2;
FakeProcess Function(String) createFakeProcess; late FakeProcess Function(String) createFakeProcess;
setUpAll(() { setUpAll(() {
imageFile = globals.fs.file('test_image_file'); imageFile = globals.fs.file('test_image_file');
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/build_system.dart';
...@@ -22,13 +20,13 @@ void main() { ...@@ -22,13 +20,13 @@ void main() {
group('ScrubGeneratedPluginRegistrant', () { group('ScrubGeneratedPluginRegistrant', () {
// The files this migration deals with // The files this migration deals with
File gitignore; late File gitignore;
File registrant; late File registrant;
// Environment overrides // Environment overrides
FileSystem fileSystem; late FileSystem fileSystem;
ProcessManager processManager; late ProcessManager processManager;
BuildSystem buildSystem; late BuildSystem buildSystem;
setUp(() { setUp(() {
// Prepare environment overrides // Prepare environment overrides
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
...@@ -28,7 +26,7 @@ final Platform platform = FakePlatform( ...@@ -28,7 +26,7 @@ final Platform platform = FakePlatform(
); );
void main() { void main() {
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:dwds/dwds.dart'; import 'package:dwds/dwds.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
...@@ -14,7 +12,7 @@ import 'package:test/fake.dart'; ...@@ -14,7 +12,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
void main() { void main() {
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
...@@ -27,7 +25,7 @@ void main() { ...@@ -27,7 +25,7 @@ void main() {
final ExpressionCompilationResult result = final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs( await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, null); '', '', 1, 1, <String, String>{}, <String, String>{}, '', '');
expectResult(result, false, 'a'); expectResult(result, false, 'a');
}); });
...@@ -39,7 +37,7 @@ void main() { ...@@ -39,7 +37,7 @@ void main() {
final ExpressionCompilationResult result = final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs( await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, null); '', '', 1, 1, <String, String>{}, <String, String>{}, '', '');
expectResult(result, true, 'Error: a'); expectResult(result, true, 'Error: a');
}); });
...@@ -50,7 +48,7 @@ void main() { ...@@ -50,7 +48,7 @@ void main() {
final ExpressionCompilationResult result = final ExpressionCompilationResult result =
await expressionCompiler.compileExpressionToJs( await expressionCompiler.compileExpressionToJs(
null, null, 1, 1, null, null, null, 'a'); '', '', 1, 1, <String, String>{}, <String, String>{}, '', 'a');
expectResult(result, true, "InternalError: frontend server failed to compile 'a'"); expectResult(result, true, "InternalError: frontend server failed to compile 'a'");
}); });
...@@ -66,10 +64,10 @@ void expectResult(ExpressionCompilationResult result, bool isError, String value ...@@ -66,10 +64,10 @@ void expectResult(ExpressionCompilationResult result, bool isError, String value
class FakeResidentCompiler extends Fake implements ResidentCompiler { class FakeResidentCompiler extends Fake implements ResidentCompiler {
FakeResidentCompiler(this.output); FakeResidentCompiler(this.output);
final CompilerOutput output; final CompilerOutput? output;
@override @override
Future<CompilerOutput> compileExpressionToJs( Future<CompilerOutput?> compileExpressionToJs(
String libraryUri, String libraryUri,
int line, int line,
int column, int column,
......
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