mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
feat: migrate fuchsia/application_package.dart to null-safe (#88095)
This commit is contained in:
parent
4bd8b288bb
commit
bf3ff7ec71
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user