Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette committed Jan 7, 2025
1 parent 50f0900 commit 211537e
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ class ProgramExplorerController extends DisposableController
final targetScript = switch (object) {
ClassRef(:final location?) ||
FieldRef(:final location?) ||
FuncRef(:final location?) =>
location.script,
FuncRef(:final location?) => location.script,
Code(:final function?) => function.location?.script,
ScriptRef() => object,
_ => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ class VMServiceObjectNode extends TreeNode<VMServiceObjectNode> {
final sourceLocation = switch (object) {
FieldRef(:final location) ||
FuncRef(:final location) ||
ClassRef(:final location) =>
location,
ClassRef(:final location) => location,
_ => null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1254,13 +1254,10 @@ class _CpuProfileTimelineTree {
String? get resolvedUrl =>
isCodeTree && _function is vm_service.FuncRef?
?
// TODO(bkonyi): not sure if this is a resolved URL or not, but it's not
// critical since this is only displayed when VM developer mode is
// enabled.
(_function as vm_service.FuncRef?)
?.location
?.script
?.uri
// TODO(bkonyi): not sure if this is a resolved URL or not, but it's not
// critical since this is only displayed when VM developer mode is
// enabled.
(_function as vm_service.FuncRef?)?.location?.script?.uri
: samples.functions![index].resolvedUrl;

int? get sourceLine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class InboundReferencesTreeNode extends TreeNode<InboundReferencesTreeNode> {
}

return switch (objectRef) {
ClassRef(:final name) || FuncRef(:final name) || FieldRef(:final name) =>
name,
ClassRef(:final name) ||
FuncRef(:final name) ||
FieldRef(:final name) => name,
LibraryRef(:final name, :final uri) => name.isNullOrEmpty ? uri : name,
ScriptRef(:final uri) => fileNameFromUri(uri),
InstanceRef(:final name, :final classRef) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ class VmServiceObjectLink extends StatelessWidget {
FieldRef(:final name) ||
FuncRef(:final name) ||
CodeRef(:final name) ||
TypeArgumentsRef(:final name) =>
name,
TypeArgumentsRef(:final name) => name,
// If a class has an empty name, it's a special "top level" class.
ClassRef(:final name) => name!.isEmpty ? 'top-level-class' : name,
LibraryRef(:final uri, :final name) =>
Expand Down
24 changes: 11 additions & 13 deletions packages/devtools_app/lib/src/shared/charts/chart_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,17 @@ class ChartController extends DisposableController
if (lastDT.difference(firstDT).inMinutes >= duration.inMinutes) {
// Grab the duration in minutes passed in.
final startOfLastNMinutes =
// We need this cast to be able to return null if nothing is found.
// ignore: unnecessary_cast
timestamps
.reversed
.firstWhereOrNull((timestamp) {
final currentDT = DateTime.fromMillisecondsSinceEpoch(timestamp);
final diff = lastDT.difference(currentDT);
if (diff.inMinutes >= duration.inMinutes) {
return true;
}

return false;
});
// We need this cast to be able to return null if nothing is found.
// ignore: unnecessary_cast
timestamps.reversed.firstWhereOrNull((timestamp) {
final currentDT = DateTime.fromMillisecondsSinceEpoch(timestamp);
final diff = lastDT.difference(currentDT);
if (diff.inMinutes >= duration.inMinutes) {
return true;
}

return false;
});

final ticksVisible =
startOfLastNMinutes != null
Expand Down
4 changes: 3 additions & 1 deletion packages/devtools_app/lib/src/shared/framework/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,9 @@ abstract class Screen {
size:
iconAsset != null
// Add 1.0 to adjust for margins on the screen icon assets.
? scaleByFontFactor(defaultIconSizeBeforeScaling + 1.0)
? scaleByFontFactor(
defaultIconSizeBeforeScaling + 1.0,
)
: defaultIconSize,
),
if (title.isNotEmpty)
Expand Down
3 changes: 1 addition & 2 deletions packages/devtools_app/lib/src/shared/memory/classes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ class SingleClassData extends ClassData {

@override
// ignore: avoid-explicit-type-declaration, required to override base class.
final ObjectSet
objects = ObjectSet();
final ObjectSet objects = ObjectSet();

@override
final byPath = <PathFromRoot, ObjectSetStats>{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,10 @@ class SidebarDevToolsScreens extends StatelessWidget {
ScreenMetaData.debugger ||
ScreenMetaData.vmTools ||
// This screen will be removed from the first party DevTools screens soon.
// If the user depends on package:provider, the provider extension should
// show up in the DevTools extensions list instead.
ScreenMetaData
.provider ||
ScreenMetaData.simple =>
false,
// If the user depends on package:provider, the provider extension should
// show up in the DevTools extensions list instead.
ScreenMetaData.provider ||
ScreenMetaData.simple => false,
_ => true,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ class FakeHeapSnapshotGraph extends Fake implements HeapSnapshotGraph {

@override
// ignore: avoid-explicit-type-declaration, required to override base class.
final List<HeapSnapshotClass>
classes = <HeapSnapshotClass>[
final List<HeapSnapshotClass> classes = <HeapSnapshotClass>[
_FakeHeapSnapshotClass(),
_FakeHeapSnapshotClass.weak(),
];

@override
// ignore: avoid-explicit-type-declaration, required to override base class.
final List<FakeSnapshotObject>
objects = <FakeSnapshotObject>[
final List<FakeSnapshotObject> objects = <FakeSnapshotObject>[
_sentinelObject,
FakeSnapshotObject(shallowSize: 1), // root
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class FakeServiceManager extends Fake

@override
// ignore: avoid-explicit-type-declaration, required to override base class.
final FakeServiceExtensionManager
serviceExtensionManager = FakeServiceExtensionManager();
final FakeServiceExtensionManager serviceExtensionManager =
FakeServiceExtensionManager();

@override
ConnectedApp? connectedApp = MockConnectedApp();
Expand Down
2 changes: 1 addition & 1 deletion tool/lib/commands/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../utils.dart';

/// Runs the DevTools web app in debug mode with `flutter run` and connects it
/// to a locally running instance of the DevTools server.
///
///
/// To open a debug connection to the DevTools server, pass the `--debug-server`
/// flag to this command.
class RunCommand extends Command {
Expand Down
8 changes: 4 additions & 4 deletions tool/lib/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class DevToolsRepo {
} else {
final ancestor = result.firstWhereOrNull(
(p) =>
// Remove the last segment of [dir]'s pathSegments to ensure we
// are only checking ancestors and not sibling directories with
// similar names.
(List.from(dir.uri.pathSegments)..safeRemoveLast())
// Remove the last segment of [dir]'s pathSegments to ensure we
// are only checking ancestors and not sibling directories with
// similar names.
(List.from(dir.uri.pathSegments)..safeRemoveLast())
// TODO(kenz): this may cause issues for Windows paths.
.join('/')
.startsWith(p.packagePath),
Expand Down

0 comments on commit 211537e

Please sign in to comment.