Skip to content

Commit 9bc85d7

Browse files
wrap Timeline calls in assert (flutter#29861)
1 parent beaf7e2 commit 9bc85d7

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

packages/flutter/lib/src/material/about.dart

+18-7
Original file line numberDiff line numberDiff line change
@@ -380,18 +380,26 @@ class _LicensePageState extends State<LicensePage> {
380380
bool _loaded = false;
381381

382382
Future<void> _initLicenses() async {
383-
final Flow flow = Flow.begin();
384-
Timeline.timeSync('_initLicenses()', () { }, flow: flow);
383+
int debugFlowId = -1;
384+
assert(() {
385+
final Flow flow = Flow.begin();
386+
Timeline.timeSync('_initLicenses()', () { }, flow: flow);
387+
debugFlowId = flow.id;
388+
return true;
389+
}());
385390
await for (LicenseEntry license in LicenseRegistry.licenses) {
386-
if (!mounted)
391+
if (!mounted) {
387392
return;
388-
Timeline.timeSync('_initLicenses()', () { }, flow: Flow.step(flow.id));
393+
}
394+
assert(() {
395+
Timeline.timeSync('_initLicenses()', () { }, flow: Flow.step(debugFlowId));
396+
return true;
397+
}());
389398
final List<LicenseParagraph> paragraphs =
390399
await SchedulerBinding.instance.scheduleTask<List<LicenseParagraph>>(
391-
() => license.paragraphs.toList(),
400+
license.paragraphs.toList,
392401
Priority.animation,
393402
debugLabel: 'License',
394-
flow: flow,
395403
);
396404
setState(() {
397405
_licenses.add(const Padding(
@@ -434,7 +442,10 @@ class _LicensePageState extends State<LicensePage> {
434442
setState(() {
435443
_loaded = true;
436444
});
437-
Timeline.timeSync('Build scheduled', () { }, flow: Flow.end(flow.id));
445+
assert(() {
446+
Timeline.timeSync('Build scheduled', () { }, flow: Flow.end(debugFlowId));
447+
return true;
448+
}());
438449
}
439450

440451
@override

0 commit comments

Comments
 (0)