Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd stackTrace to AsyncSnapshot #69507
Conversation
| @@ -318,12 +343,12 @@ typedef AsyncWidgetBuilder<T> = Widget Function(BuildContext context, AsyncSnaps | |||
| /// of the following snapshots that includes the last one (the one with | |||
| /// ConnectionState.done): | |||
| /// | |||
| /// * `new AsyncSnapshot<int>.withData(ConnectionState.waiting, null)` | |||
justinmc
Nov 2, 2020
Contributor
Good catch! This must be old.
Good catch! This must be old.
Description
This PR adds a
stackTracemember that allows to trace errors inStreamBuilderandFutureBuilder. Previously, errors were not tracable in said widgets.The
stackTracemember is always specified when theerrormember is also specified.Non-breaking
The
stackTraceis a new optional parameter forAsyncSnapshot.withError; if not specified,StackTrace.emptywill be used, which aligns with what stream controllers, completers, etc. do.Related Issues
Tests
I added the following tests:
AsyncSnapshot.stackTraceinasync_test.dart.onStringchanges in the same file.Checklist
Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.
toStringmethod ofAsyncSnapshot. User code should realistically not depend ontoStringbecause the class provides the members publicly.