StreamBuilder Crashes App

26 views
Skip to first unread message

Gedeon Muissa

unread,
Mar 3, 2021, 6:50:32 PM3/3/21
to Flutter Development (flutter-dev)
App crashes when using streambuilder not immediately after launch but after a certain time. Let’s say 5 to 6 minutes. Did anyone come accros this?

Suzuki Tomohiro

unread,
Mar 3, 2021, 8:36:55 PM3/3/21
to Gedeon Muissa, Flutter Development (flutter-dev)
I had an experience where my app was showing too many images at once. The app crashed 10 seconds after the startup. It generated no crashlytics log. I had to reproduce the issue in Xcode debug mode to see the cause of the crash was memory consumption.

So, try running your app in Xcode. It gives better error message than Android Studio or VScode.

On Wed, Mar 3, 2021 at 18:50 Gedeon Muissa <gedeon...@gmail.com> wrote:
App crashes when using streambuilder not immediately after launch but after a certain time. Let’s say 5 to 6 minutes. Did anyone come accros this?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CAPPVX7xd%3D2umpZBHAqsvSs7Leh0g0HGjjEkcMNkdzd4FEYxnhA%40mail.gmail.com.

Gedeon Muissa

unread,
Mar 3, 2021, 10:34:17 PM3/3/21
to Suzuki Tomohiro, Flutter Development (flutter-dev)
Thank you for the fast response, mine is a simple Streambuilder using Firestore with only 4 documents(no images are loaded). I will continue investigating my code

John Boudreaux

unread,
Mar 4, 2021, 12:47:02 PM3/4/21
to Flutter Development (flutter-dev)
Perhaps when StreamBuilder subscribes to the stream, Firestore sends a snapshot but it has no data. Did you check the snapshot.hasData or snapshort.hasError flags? I do a streambuilder on a Firestore collection that works for me. Here is the relevant code from the builder.
```
return snapshot.hasData
   ? Column(
         children: snapshot.data
             .map<CautionWidget>((cm) => CautionWidget(key: Key(cm.id), cautionModel: cm,),).toList())
: Text('Add some cautions');
```
Reply all
Reply to author
Forward
0 new messages