From bf3ff7ec71524fcb66a5029651015bd19336f4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=98=9F=E5=9B=94?= Date: Fri, 13 Aug 2021 15:22:07 +0800 Subject: [PATCH] feat: migrate fuchsia/application_package.dart to null-safe (#88095) --- .../lib/src/fuchsia/application_package.dart | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/flutter_tools/lib/src/fuchsia/application_package.dart b/packages/flutter_tools/lib/src/fuchsia/application_package.dart index ada42ab48df..19d17ea721d 100644 --- a/packages/flutter_tools/lib/src/fuchsia/application_package.dart +++ b/packages/flutter_tools/lib/src/fuchsia/application_package.dart @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - -import 'package:meta/meta.dart'; - import '../application_package.dart'; import '../base/file_system.dart'; import '../build_info.dart'; @@ -13,10 +9,10 @@ import '../globals_null_migrated.dart' as globals; import '../project.dart'; abstract class FuchsiaApp extends ApplicationPackage { - FuchsiaApp({@required String projectBundleId}) : super(id: projectBundleId); + FuchsiaApp({required String projectBundleId}) : super(id: projectBundleId); /// Creates a new [FuchsiaApp] from a fuchsia sub project. - factory FuchsiaApp.fromFuchsiaProject(FuchsiaProject project) { + static FuchsiaApp? fromFuchsiaProject(FuchsiaProject project) { if (!project.existsSync()) { // If the project doesn't exist at all the current hint to run flutter // create is accurate. @@ -30,7 +26,7 @@ abstract class FuchsiaApp extends ApplicationPackage { /// Creates a new [FuchsiaApp] from an existing .far archive. /// /// [applicationBinary] is the path to the .far archive. - factory FuchsiaApp.fromPrebuiltApp(FileSystemEntity applicationBinary) { + static FuchsiaApp? fromPrebuiltApp(FileSystemEntity applicationBinary) { final FileSystemEntityType entityType = globals.fs.typeSync(applicationBinary.path); if (entityType != FileSystemEntityType.file) { globals.printError('File "${applicationBinary.path}" does not exist or is not a .far file. Use far archive.'); @@ -50,7 +46,7 @@ abstract class FuchsiaApp extends ApplicationPackage { class PrebuiltFuchsiaApp extends FuchsiaApp { PrebuiltFuchsiaApp({ - @required String farArchive, + required String farArchive, }) : _farArchive = farArchive, // TODO(zra): Extract the archive and extract the id from meta/package. super(projectBundleId: farArchive); @@ -65,7 +61,7 @@ class PrebuiltFuchsiaApp extends FuchsiaApp { } class BuildableFuchsiaApp extends FuchsiaApp { - BuildableFuchsiaApp({this.project}) : + BuildableFuchsiaApp({required this.project}) : super(projectBundleId: project.project.manifest.appName); final FuchsiaProject project;