Unverified Commit 9bc85d7e authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

wrap Timeline calls in assert (#29861)

parent beaf7e28
...@@ -380,18 +380,26 @@ class _LicensePageState extends State<LicensePage> { ...@@ -380,18 +380,26 @@ class _LicensePageState extends State<LicensePage> {
bool _loaded = false; bool _loaded = false;
Future<void> _initLicenses() async { Future<void> _initLicenses() async {
int debugFlowId = -1;
assert(() {
final Flow flow = Flow.begin(); final Flow flow = Flow.begin();
Timeline.timeSync('_initLicenses()', () { }, flow: flow); Timeline.timeSync('_initLicenses()', () { }, flow: flow);
debugFlowId = flow.id;
return true;
}());
await for (LicenseEntry license in LicenseRegistry.licenses) { await for (LicenseEntry license in LicenseRegistry.licenses) {
if (!mounted) if (!mounted) {
return; return;
Timeline.timeSync('_initLicenses()', () { }, flow: Flow.step(flow.id)); }
assert(() {
Timeline.timeSync('_initLicenses()', () { }, flow: Flow.step(debugFlowId));
return true;
}());
final List<LicenseParagraph> paragraphs = final List<LicenseParagraph> paragraphs =
await SchedulerBinding.instance.scheduleTask<List<LicenseParagraph>>( await SchedulerBinding.instance.scheduleTask<List<LicenseParagraph>>(
() => license.paragraphs.toList(), license.paragraphs.toList,
Priority.animation, Priority.animation,
debugLabel: 'License', debugLabel: 'License',
flow: flow,
); );
setState(() { setState(() {
_licenses.add(const Padding( _licenses.add(const Padding(
...@@ -434,7 +442,10 @@ class _LicensePageState extends State<LicensePage> { ...@@ -434,7 +442,10 @@ class _LicensePageState extends State<LicensePage> {
setState(() { setState(() {
_loaded = true; _loaded = true;
}); });
Timeline.timeSync('Build scheduled', () { }, flow: Flow.end(flow.id)); assert(() {
Timeline.timeSync('Build scheduled', () { }, flow: Flow.end(debugFlowId));
return true;
}());
} }
@override @override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment