[flutter_tools] Fix bad state future already completed in flutter logs (#138517)

Fixes https://github.com/flutter/flutter/issues/138436
This commit is contained in:
Christopher Fujino
2023-11-23 11:56:14 -08:00
committed by GitHub
parent d92d2c12b2
commit 4c978efead
4 changed files with 82 additions and 13 deletions

View File

@@ -118,6 +118,7 @@ class FakeDevice extends Device {
this.connectionInterface = DeviceConnectionInterface.attached,
PlatformType type = PlatformType.web,
LaunchResult? launchResult,
this.deviceLogReader,
}) : _isSupported = isSupported,
_isSupportedForProject = isSupportedForProject,
_launchResult = launchResult ?? LaunchResult.succeeded(),
@@ -131,6 +132,7 @@ class FakeDevice extends Device {
final bool _isSupported;
final bool _isSupportedForProject;
final LaunchResult _launchResult;
DeviceLogReader? deviceLogReader;
@override
final String name;
@@ -183,6 +185,12 @@ class FakeDevice extends Device {
@override
Future<String> sdkNameAndVersion = Future<String>.value('Test SDK (1.2.3)');
@override
FutureOr<DeviceLogReader> getLogReader({
ApplicationPackage? app,
bool includePastLogs = false,
}) => deviceLogReader ?? FakeDeviceLogReader();
}
/// Combines fake device with its canonical JSON representation.