Skip to content

Commit

Permalink
Migrate screens/profiler code to null safety (#3829)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Mar 10, 2022
1 parent 9455093 commit 85a45e5
Show file tree
Hide file tree
Showing 20 changed files with 356 additions and 352 deletions.
12 changes: 6 additions & 6 deletions packages/devtools_app/lib/src/charts/flame_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ abstract class FlameChart<T, V> extends StatefulWidget {

final double endInset;

final ValueListenable<V> selectionNotifier;
final ValueListenable<V?> selectionNotifier;

final ValueListenable<List<V>>? searchMatchesNotifier;

Expand Down Expand Up @@ -238,7 +238,7 @@ abstract class FlameChartState<T extends FlameChart,

if (widget.activeSearchMatchNotifier != null) {
addAutoDisposeListener(widget.activeSearchMatchNotifier, () async {
final activeSearch = widget.activeSearchMatchNotifier as V?;
final activeSearch = widget.activeSearchMatchNotifier!.value as V?;
if (activeSearch == null) return;

// Ensure the [activeSearch] is vertically in view.
Expand Down Expand Up @@ -347,7 +347,7 @@ abstract class FlameChartState<T extends FlameChart,
nodes: nodes,
width: math.max(constraints.maxWidth, widthWithZoom),
startInset: widget.startInset,
selectionNotifier: widget.selectionNotifier as ValueListenable<V>,
selectionNotifier: widget.selectionNotifier as ValueListenable<V?>,
searchMatchesNotifier:
widget.searchMatchesNotifier as ValueListenable<List<V>>?,
activeSearchMatchNotifier:
Expand Down Expand Up @@ -664,10 +664,10 @@ class ScrollingFlameChartRowState<V extends FlameChartDataMixin<V>>

selected = widget.selectionNotifier.value;
addAutoDisposeListener(widget.selectionNotifier, () {
final containsPreviousSelected = _nodeData.contains(selected);
final containsNewSelected =
_nodeData.contains(widget.selectionNotifier.value);
final containsPreviousSelected =
selected != null && _nodeData.contains(selected);
selected = widget.selectionNotifier.value;
final containsNewSelected = _nodeData.contains(selected);
// We only want to rebuild the row if it contains the previous or new
// selected node.
if (containsPreviousSelected || containsNewSelected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,10 @@ class PerformanceController extends DisposableController
);
await processTraceEvents(traceEvents);
if (data.cpuProfileData != null) {
await cpuProfilerController.transformer
.processData(offlinePerformanceData.cpuProfileData);
await cpuProfilerController.transformer.processData(
offlinePerformanceData.cpuProfileData,
processId: 'process offline data',
);
}

offlinePerformanceData.frames.forEach(_assignEventsToFrame);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:flutter/material.dart';

import '../../primitives/utils.dart';
Expand All @@ -14,7 +12,7 @@ import 'cpu_profile_model.dart';

/// A table of the CPU's bottom-up call tree.
class CpuBottomUpTable extends StatelessWidget {
factory CpuBottomUpTable(List<CpuStackFrame> bottomUpRoots, {Key key}) {
factory CpuBottomUpTable(List<CpuStackFrame> bottomUpRoots, {Key? key}) {
final treeColumn = MethodNameColumn();
final startingSortColumn = SelfTimeColumn(titleTooltip: selfTimeTooltip);
final columns = List<ColumnData<CpuStackFrame>>.unmodifiable([
Expand All @@ -33,7 +31,7 @@ class CpuBottomUpTable extends StatelessWidget {
}

const CpuBottomUpTable._(
Key key,
Key? key,
this.bottomUpRoots,
this.treeColumn,
this.sortColumn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:flutter/material.dart';

import '../../primitives/utils.dart';
Expand All @@ -14,7 +12,7 @@ import 'cpu_profile_model.dart';

/// A table of the CPU's top-down call tree.
class CpuCallTreeTable extends StatelessWidget {
factory CpuCallTreeTable(List<CpuStackFrame> dataRoots, {Key key}) {
factory CpuCallTreeTable(List<CpuStackFrame> dataRoots, {Key? key}) {
final treeColumn = MethodNameColumn();
final startingSortColumn = TotalTimeColumn(titleTooltip: totalTimeTooltip);
final columns = List<ColumnData<CpuStackFrame>>.unmodifiable([
Expand All @@ -33,7 +31,7 @@ class CpuCallTreeTable extends StatelessWidget {
}

const CpuCallTreeTable._(
Key key,
Key? key,
this.dataRoots,
this.treeColumn,
this.sortColumn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import '../../primitives/utils.dart';
import '../../shared/table_data.dart';
import '../../shared/utils.dart';
Expand All @@ -12,7 +10,7 @@ import 'cpu_profile_model.dart';
const _timeColumnWidthPx = 180.0;

class SelfTimeColumn extends ColumnData<CpuStackFrame> {
SelfTimeColumn({String titleTooltip})
SelfTimeColumn({String? titleTooltip})
: super(
'Self Time',
titleTooltip: titleTooltip,
Expand Down Expand Up @@ -46,7 +44,7 @@ class SelfTimeColumn extends ColumnData<CpuStackFrame> {
}

class TotalTimeColumn extends ColumnData<CpuStackFrame> {
TotalTimeColumn({String titleTooltip})
TotalTimeColumn({String? titleTooltip})
: super(
'Total Time',
titleTooltip: titleTooltip,
Expand Down
Loading

0 comments on commit 85a45e5

Please sign in to comment.