forked from firka/flutter
Flutter preview device (#135639)
Fixes https://github.com/flutter/flutter/issues/130277 This PR does two things: 1. introduce a hidden `flutter build _preview` command, that will build a debug windows desktop app and copy it into the SDK's binary cache. This command is only intended to be run during packaging. 2. introduce a new device type, called `PreviewDevice`, which relies on the prebuilt desktop debug app from step 1, copies it into the target app's assets build folder, and then hot reloads their dart code into it.
This commit is contained in:
committed by
GitHub
parent
492b6f7ddf
commit
8a31a3a284
@@ -382,7 +382,8 @@ class NoopCrashReporter implements CrashReporter {
|
||||
}
|
||||
|
||||
class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
|
||||
// Use [FakeSignals] so developers running the test suite can kill the test runner.
|
||||
// Use [FakeSignals] so developers running the test suite can kill the test
|
||||
// runner.
|
||||
LocalFileSystemBlockingSetCurrentDirectory() : super.test(signals: FakeSignals());
|
||||
|
||||
@override
|
||||
|
||||
@@ -462,6 +462,7 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
this.isFlutterWebWasmEnabled = false,
|
||||
this.isCliAnimationEnabled = true,
|
||||
this.isNativeAssetsEnabled = false,
|
||||
this.isPreviewDeviceEnabled = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -497,31 +498,24 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
@override
|
||||
final bool isNativeAssetsEnabled;
|
||||
|
||||
@override
|
||||
final bool isPreviewDeviceEnabled;
|
||||
|
||||
@override
|
||||
bool isEnabled(Feature feature) {
|
||||
switch (feature) {
|
||||
case flutterWebFeature:
|
||||
return isWebEnabled;
|
||||
case flutterLinuxDesktopFeature:
|
||||
return isLinuxEnabled;
|
||||
case flutterMacOSDesktopFeature:
|
||||
return isMacOSEnabled;
|
||||
case flutterWindowsDesktopFeature:
|
||||
return isWindowsEnabled;
|
||||
case flutterAndroidFeature:
|
||||
return isAndroidEnabled;
|
||||
case flutterIOSFeature:
|
||||
return isIOSEnabled;
|
||||
case flutterFuchsiaFeature:
|
||||
return isFuchsiaEnabled;
|
||||
case flutterCustomDevicesFeature:
|
||||
return areCustomDevicesEnabled;
|
||||
case cliAnimation:
|
||||
return isCliAnimationEnabled;
|
||||
case nativeAssets:
|
||||
return isNativeAssetsEnabled;
|
||||
}
|
||||
return false;
|
||||
return switch (feature) {
|
||||
flutterWebFeature => isWebEnabled,
|
||||
flutterLinuxDesktopFeature => isLinuxEnabled,
|
||||
flutterMacOSDesktopFeature => isMacOSEnabled,
|
||||
flutterWindowsDesktopFeature => isWindowsEnabled,
|
||||
flutterAndroidFeature => isAndroidEnabled,
|
||||
flutterIOSFeature => isIOSEnabled,
|
||||
flutterFuchsiaFeature => isFuchsiaEnabled,
|
||||
flutterCustomDevicesFeature => areCustomDevicesEnabled,
|
||||
cliAnimation => isCliAnimationEnabled,
|
||||
nativeAssets => isNativeAssetsEnabled,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user