Give `StreamBuilder` ability to be lossless

This issue has been tracked since 2022-09-22.

The documentation for StreamBuilder clearly states that the builder isn't called 1-to-1 with the Stream and that its intention is to just display the latest snapshot. However that doesn't stop people from assuming that it is 1-to-1 as evidenced in the StackOverflow answer here:

I suspect the name of the class and its signature communicates that it may behave different than it does. A more proper name may have been LatestSnapshotBuilder. The punishment for using the API incorrectly is too high in this case. Imagine shipping a product that behaves correctly on your internet then a user that has a fast internet connection uses it and data is missing from the list.

Since the fail case is so dire I think we should have an escape valve in the API design, a bool that guarantees that StreamBuilder calls the builder 1-to-1 with the stream events. We could rename the class but that would probably be too disruptive.

Proposed API:

  const StreamBuilder({
    required this.builder,
    bool isLossless = false,  // <-- new parameter
bernaferrari wrote this answer on 2022-09-23

You should check the "swallow error" property from StreamBuilder/FutureBuilder, maybe isLossless could be made on the same way, a global variable, so users can override everywhere instead individually.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-04
Star Count 145499
Watcher Count 3567
Fork Count 23393
Issue Count 11206


Issue Title Created Date Updated Date