Closed mpastewski closed 8 months ago
How is this related to Provider? To me it sounds like your stream is emitting an exception. Provider isn't responsible for this
Thanks Remi for this hint that I should seek more on the Stream side and sorry for opening this issue in Provider. How would you troubleshoot it from there?
I don't think there's a clear way for me to help. But I'd suggest asking on forums, like Discord
Describe the bug I'm using StreamBuilder to listen to changes in user authentication and then StreamProvider to fetch data from Firestore while constantly listening to changes in user documents. I sometimes got occasional crashes for a small percentage of users, but lately, this number has risen.
This is the crash from Crashlytics:
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: An exception was throw by _MapStream<DocumentSnapshot<Map<String, dynamic>>, UserData> listened by at FirebaseCrashlytics.recordError(firebase_crashlytics.dart:119) at FirebaseCrashlytics.recordFlutterError(firebase_crashlytics.dart:145) at FlutterError.reportError(assertions.dart:1185) at _streamStartListening.<fn>.<fn>(async_provider.dart:32)
To Reproduce ` runApp(
);
` Stream getUserData(String? uid) {
if (uid != null) {
} return Stream.value(UserData());
}`
Expected behavior I want to use:
final data = Provider.of<UserData>(context, listen: false);
In the entire app get the newest version of UserData while still being sure that the user is authenticated.