feat: migrate windows/application_package.dart to null-safety (#88081)

This commit is contained in:
嘟囔 2021-08-12 12:02:03 +08:00 committed by GitHub
parent 10e4b04010
commit a17723d46b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 '../base/utils.dart';
@ -15,7 +11,7 @@ import '../cmake_project.dart';
import '../globals_null_migrated.dart' as globals;
abstract class WindowsApp extends ApplicationPackage {
WindowsApp({@required String projectBundleId}) : super(id: projectBundleId);
WindowsApp({required String projectBundleId}) : super(id: projectBundleId);
/// Creates a new [WindowsApp] from a windows sub project.
factory WindowsApp.fromWindowsProject(WindowsProject project) {
@ -41,7 +37,7 @@ abstract class WindowsApp extends ApplicationPackage {
class PrebuiltWindowsApp extends WindowsApp {
PrebuiltWindowsApp({
@required String executable,
required String executable,
}) : _executable = executable,
super(projectBundleId: executable);
@ -56,14 +52,14 @@ class PrebuiltWindowsApp extends WindowsApp {
class BuildableWindowsApp extends WindowsApp {
BuildableWindowsApp({
@required this.project,
required this.project,
}) : super(projectBundleId: project.parent.manifest.appName);
final WindowsProject project;
@override
String executable(BuildMode buildMode) {
final String binaryName = getCmakeExecutableName(project);
final String? binaryName = getCmakeExecutableName(project);
return globals.fs.path.join(
getWindowsBuildDirectory(),
'runner',
@ -77,12 +73,12 @@ class BuildableWindowsApp extends WindowsApp {
}
class BuildableUwpApp extends ApplicationPackage {
BuildableUwpApp({@required this.project}) : super(id: project.packageGuid);
BuildableUwpApp({required this.project}) : super(id: project.packageGuid ?? 'com.example.placeholder');
final WindowsUwpProject project;
String get projectVersion => project.packageVersion;
String? get projectVersion => project.packageVersion;
@override
String get name => getCmakeExecutableName(project);
String? get name => getCmakeExecutableName(project);
}