Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg
echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update
sudo apt-get install dcm=1.24.2-1 # To avoid errors add `-1` (build number) to the version
sudo apt-get install dcm=1.28.0-1 # To avoid errors add `-1` (build number) to the version
sudo chmod +x /usr/bin/dcm
echo "$(dcm --version)"
- name: Setup Dart SDK
Expand Down
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a7f820163c5d7d5321872c60f22fa047fb94bd7b
80d0409d137acdd55af4124b7622915c062c9d21
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ Future<void> _runBenchmarks({bool useWasm = false}) async {
final taskResult = await serveWebBenchmark(
benchmarkAppDirectory: projectRootDirectory(),
entryPoint: generateBenchmarkEntryPoint(useWasm: useWasm),
compilationOptions:
useWasm
? const CompilationOptions.wasm()
: const CompilationOptions.js(),
compilationOptions: useWasm
? const CompilationOptions.wasm()
: const CompilationOptions.js(),
treeShakeIcons: false,
benchmarkPath: benchmarkPath(useWasm: useWasm),
);
Expand Down
7 changes: 3 additions & 4 deletions packages/devtools_app/benchmark/scripts/run_benchmarks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ Future<BenchmarkResults> runBenchmarks({
await serveWebBenchmark(
benchmarkAppDirectory: projectRootDirectory(),
entryPoint: generateBenchmarkEntryPoint(useWasm: useWasm),
compilationOptions:
useWasm
? const CompilationOptions.wasm()
: const CompilationOptions.js(),
compilationOptions: useWasm
? const CompilationOptions.wasm()
: const CompilationOptions.js(),
treeShakeIcons: false,
benchmarkPath: benchmarkPath(useWasm: useWasm),
headless: !useBrowser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@ import '../devtools_recorder.dart';
typedef RecorderFactory = Recorder Function();

final benchmarks = <String, RecorderFactory>{
DevToolsBenchmark.navigateThroughOfflineScreens.id:
() => DevToolsRecorder(
benchmark: DevToolsBenchmark.navigateThroughOfflineScreens,
),
DevToolsBenchmark.offlineCpuProfilerScreen.id:
() => DevToolsRecorder(
benchmark: DevToolsBenchmark.offlineCpuProfilerScreen,
),
DevToolsBenchmark.offlinePerformanceScreen.id:
() => DevToolsRecorder(
benchmark: DevToolsBenchmark.offlinePerformanceScreen,
),
DevToolsBenchmark.navigateThroughOfflineScreens.id: () => DevToolsRecorder(
benchmark: DevToolsBenchmark.navigateThroughOfflineScreens,
),
DevToolsBenchmark.offlineCpuProfilerScreen.id: () =>
DevToolsRecorder(benchmark: DevToolsBenchmark.offlineCpuProfilerScreen),
DevToolsBenchmark.offlinePerformanceScreen.id: () =>
DevToolsRecorder(benchmark: DevToolsBenchmark.offlinePerformanceScreen),
};
9 changes: 4 additions & 5 deletions packages/devtools_app/benchmark/test_infra/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ const _benchmarkInitialPage = '';

const _wasmQueryParameters = {'wasm': 'true'};

String benchmarkPath({required bool useWasm}) =>
Uri(
path: _benchmarkInitialPage,
queryParameters: useWasm ? _wasmQueryParameters : null,
).toString();
String benchmarkPath({required bool useWasm}) => Uri(
path: _benchmarkInitialPage,
queryParameters: useWasm ? _wasmQueryParameters : null,
).toString();

String generateBenchmarkEntryPoint({required bool useWasm}) {
return 'benchmark/test_infra/client/client_${useWasm ? 'wasm' : 'js'}.dart';
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_app/integration_test/run_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void main(List<String> args) async {
testRunnerArgs: testRunnerArgs,
runTest: _runTest,
newArgsGenerator: (args) => DevToolsAppTestRunnerArgs(args),
testIsSupported:
(testFile) => testRunnerArgs.testAppDevice.supportsTest(testFile.path),
testIsSupported: (testFile) =>
testRunnerArgs.testAppDevice.supportsTest(testFile.path),
debugLogging: debugTestScript,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,10 @@ Future<void> _verifyExtensionsSettingsMenu(
await _openExtensionSettingsMenu(tester);

expect(find.byType(ExtensionSetting), findsNWidgets(enabledStates.length));
final toggleButtonGroups =
tester
.widgetList(find.byType(DevToolsToggleButtonGroup))
.cast<DevToolsToggleButtonGroup>()
.toList();
final toggleButtonGroups = tester
.widgetList(find.byType(DevToolsToggleButtonGroup))
.cast<DevToolsToggleButtonGroup>()
.toList();
for (int i = 0; i < toggleButtonGroups.length; i++) {
logStatus('verify extension settings toggle button states (index $i)');
final group = toggleButtonGroups[i];
Expand Down Expand Up @@ -313,11 +312,10 @@ Future<void> _changeExtensionSetting(
'changing the extension setting at index $extensionIndex to value $settingValue',
);
await _openExtensionSettingsMenu(tester);
final extensionSetting =
tester
.widgetList(find.byType(DevToolsToggleButtonGroup))
.cast<DevToolsToggleButtonGroup>()
.toList()[extensionIndex];
final extensionSetting = tester
.widgetList(find.byType(DevToolsToggleButtonGroup))
.cast<DevToolsToggleButtonGroup>()
.toList()[extensionIndex];
await tester.tap(
find.descendant(
of: find.byWidget(extensionSetting),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ class TestFlutterApp extends IntegrationTestApp {
return _timeoutWithMessages<Map<String, Object?>>(
() => response.future,
timeout: timeout,
message:
event != null
? 'Did not receive expected $event event.'
: 'Did not receive response to request "$id".',
message: event != null
? 'Did not receive expected $event event.'
: 'Did not receive response to request "$id".',
).whenComplete(() => sub.cancel());
}

Expand Down Expand Up @@ -350,8 +349,8 @@ abstract class IntegrationTestApp with IOMixin {
_debugPrint('Waiting for process to end');
return runProcess!.exitCode.timeout(
IOMixin.killTimeout,
onTimeout:
() => killGracefully(runProcess!, debugLogging: debugTestScript),
onTimeout: () =>
killGracefully(runProcess!, debugLogging: debugTestScript),
);
}

Expand Down Expand Up @@ -387,8 +386,9 @@ abstract class IntegrationTestApp with IOMixin {

String _debugPrint(String msg) {
const maxLength = 500;
final truncatedMsg =
msg.length > maxLength ? '${msg.substring(0, maxLength)}...' : msg;
final truncatedMsg = msg.length > maxLength
? '${msg.substring(0, maxLength)}...'
: msg;
_allMessages.add(truncatedMsg);
debugLog('_TestApp - $truncatedMsg');
return msg;
Expand All @@ -404,12 +404,11 @@ Uri convertToWebSocketUrl({required Uri serviceProtocolUrl}) {
serviceProtocolUrl.isScheme('https');
final scheme = isSecure ? 'wss' : 'ws';

final path =
serviceProtocolUrl.path.endsWith('/ws')
? serviceProtocolUrl.path
: (serviceProtocolUrl.path.endsWith('/')
? '${serviceProtocolUrl.path}ws'
: '${serviceProtocolUrl.path}/ws');
final path = serviceProtocolUrl.path.endsWith('/ws')
? serviceProtocolUrl.path
: (serviceProtocolUrl.path.endsWith('/')
? '${serviceProtocolUrl.path}ws'
: '${serviceProtocolUrl.path}/ws');

return serviceProtocolUrl.replace(scheme: scheme, path: path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ Future<void> runFlutterIntegrationTest(
class DevToolsAppTestRunnerArgs extends IntegrationTestRunnerArgs {
DevToolsAppTestRunnerArgs(super.args, {super.verifyValidTarget = true})
: super(addExtraArgs: _addExtraArgs) {
testAppDevice =
TestAppDevice.fromArgName(
argResults.option(_testAppDeviceArg) ??
TestAppDevice.flutterTester.argName,
)!;
testAppDevice = TestAppDevice.fromArgName(
argResults.option(_testAppDeviceArg) ??
TestAppDevice.flutterTester.argName,
)!;
}

/// The type of device for the test app to run on.
Expand Down
86 changes: 42 additions & 44 deletions packages/devtools_app/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
if (FeatureFlags.devToolsExtensions) {
// TODO(https://github.com/flutter/devtools/issues/6273): stop special
// casing the package:provider extension.
final containsProviderExtension =
extensionService.currentExtensions.value.visibleExtensions
.where((e) => e.name == 'provider')
.isNotEmpty;
final devToolsScreens =
containsProviderExtension
? _originalScreens
.where((s) => s.screenId != ScreenMetaData.provider.id)
.toList()
: _originalScreens;
final containsProviderExtension = extensionService
.currentExtensions
.value
.visibleExtensions
.where((e) => e.name == 'provider')
.isNotEmpty;
final devToolsScreens = containsProviderExtension
? _originalScreens
.where((s) => s.screenId != ScreenMetaData.provider.id)
.toList()
: _originalScreens;
return [...devToolsScreens, ..._extensionScreens];
}
return _originalScreens;
Expand Down Expand Up @@ -287,16 +288,15 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
extensionService.currentExtensions,
],
builder: (_, _, child) {
final screensInScaffold =
_visibleScreens()
.where(
(s) => maybeIncludeOnlyEmbeddedScreen(
s,
page: page,
embedMode: embedMode,
),
)
.toList();
final screensInScaffold = _visibleScreens()
.where(
(s) => maybeIncludeOnlyEmbeddedScreen(
s,
page: page,
embedMode: embedMode,
),
)
.toList();

removeHiddenScreens(screensInScaffold, queryParams);

Expand Down Expand Up @@ -354,26 +354,25 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
embedMode: embedMode,
page: page,
screens: screensInScaffold,
actions:
isEmbedded()
? []
: [
if (paramsContainVmServiceUri) ...[
// Hide the hot reload button for Dart web apps, where the
// hot reload service extension is not avilable and where the
// [service.reloadServices] RPC is not implemented.
// TODO(https://github.com/flutter/devtools/issues/6441): find
// a way to show this for Dart web apps when supported.
if (!connectedToDartWebApp)
HotReloadButton(
callOnVmServiceDirectly: !connectedToFlutterApp,
),
// This button will hide itself based on whether the
// hot restart service is available for the connected app.
const HotRestartButton(),
],
...DevToolsScaffold.defaultActions(),
actions: isEmbedded()
? []
: [
if (paramsContainVmServiceUri) ...[
// Hide the hot reload button for Dart web apps, where the
// hot reload service extension is not avilable and where the
// [service.reloadServices] RPC is not implemented.
// TODO(https://github.com/flutter/devtools/issues/6441): find
// a way to show this for Dart web apps when supported.
if (!connectedToDartWebApp)
HotReloadButton(
callOnVmServiceDirectly: !connectedToFlutterApp,
),
// This button will hide itself based on whether the
// hot restart service is available for the connected app.
const HotRestartButton(),
],
...DevToolsScaffold.defaultActions(),
],
);
}
return scaffold;
Expand Down Expand Up @@ -657,8 +656,8 @@ class ScreenUnavailable extends StatelessWidget {
if (embedMode == EmbedMode.none) ...[
const SizedBox(height: defaultSpacing),
ElevatedButton(
onPressed:
() => routerDelegate.navigateHome(clearScreenParam: true),
onPressed: () =>
routerDelegate.navigateHome(clearScreenParam: true),
child: const Text('Go to Home screen'),
),
],
Expand Down Expand Up @@ -702,9 +701,8 @@ List<DevToolsScreen> defaultScreens({
),
DevToolsScreen<DebuggerController>(
DebuggerScreen(),
createController:
(routerDelegate) =>
DebuggerController(routerDelegate: routerDelegate),
createController: (routerDelegate) =>
DebuggerController(routerDelegate: routerDelegate),
),
DevToolsScreen<NetworkController>(
NetworkScreen(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController
);
final queryParams = {
...DevToolsQueryParams.load().params,
ExtensionEventParameters.theme:
isDarkThemeEnabled()
? ExtensionEventParameters.themeValueDark
: ExtensionEventParameters.themeValueLight,
ExtensionEventParameters.theme: isDarkThemeEnabled()
? ExtensionEventParameters.themeValueDark
: ExtensionEventParameters.themeValueLight,
if (dtdManager.uri != null) 'dtdUri': dtdManager.uri.toString(),
};
return Uri.parse(baseUri).replace(queryParameters: queryParams).toString();
Expand All @@ -89,12 +88,11 @@ class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController
);
_initialized = true;

_extensionIFrame =
HTMLIFrameElement()
// This url is safe because we built it ourselves and it does not include
// any user input.
..src = extensionUrl
..allow = 'usb';
_extensionIFrame = HTMLIFrameElement()
// This url is safe because we built it ourselves and it does not include
// any user input.
..src = extensionUrl
..allow = 'usb';
_extensionIFrame.style
..border = 'none'
..height = '100%'
Expand Down
27 changes: 12 additions & 15 deletions packages/devtools_app/lib/src/extensions/embedded/_view_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ class _ExtensionIFrameController extends DisposableController

addAutoDisposeListener(preferences.darkModeEnabled, () {
updateTheme(
theme:
isDarkThemeEnabled()
? ExtensionEventParameters.themeValueDark
: ExtensionEventParameters.themeValueLight,
theme: isDarkThemeEnabled()
? ExtensionEventParameters.themeValueDark
: ExtensionEventParameters.themeValueLight,
);
});
}
Expand Down Expand Up @@ -184,10 +183,9 @@ class _ExtensionIFrameController extends DisposableController
if (extensionEvent != null) {
onEventReceived(
extensionEvent,
onUnknownEvent:
() => notificationService.push(
'Unknown event received from extension: $extensionEvent}',
),
onUnknownEvent: () => notificationService.push(
'Unknown event received from extension: $extensionEvent}',
),
);
}
}
Expand Down Expand Up @@ -316,13 +314,12 @@ class _ExtensionIFrameController extends DisposableController
screenId: '${showBannerMessageEvent.extensionName}_ext',
dismissOnConnectionChanges:
showBannerMessageEvent.dismissOnConnectionChanges,
buildTextSpans:
(_) => [
TextSpan(
text: showBannerMessageEvent.message,
style: TextStyle(fontSize: defaultFontSize),
),
],
buildTextSpans: (_) => [
TextSpan(
text: showBannerMessageEvent.message,
style: TextStyle(fontSize: defaultFontSize),
),
],
);
bannerMessages.addMessage(
bannerMessage,
Expand Down
Loading