0

I have a strange situation with respect to riverpod running on the web. The code below works fine in ios, macos and Chrome when debugging with vsCode, however, it crashes after I deploy it to firebase hosting, on the following line:

final AsyncValue<TBRinProgress> completedTbrAsyncValue = watch(completedTbrStreamProvider(id));

that refers to this line:

final completedTbrStreamProvider =
StreamProvider.autoDispose.family<TBRinProgress, String>((ref, id) {
  final database = ref.watch(databaseProvider);
  final questions = ref.watch(questionStreamProvider);
  if (database != null && id != null && questions is! AsyncLoading) {
    return database.completedTbrStream(
        completedTbrId: id, questions: questions.data.value);
  } else {
    return const Stream.empty();
  }
});

In the chrome console, I get the following error and stack trace:

Unsupported operation: Unknown ProviderListenable AutoDisposeStreamProvider<dynamic>#0000a(from: Instance of 'AutoDisposeStreamProviderFamily<dynamic, dynamic>', argument: 2021-03-17T16:04:40.472)
main.dart.js:9844     at Object.wrapException (https://mxotechaccountmanager.web.app/main.dart.js:7400:17)
main.dart.js:9844     at ProviderContainer.listen$1$2$mayHaveChanged (https://mxotechaccountmanager.web.app/main.dart.js:150983:17)
main.dart.js:9844     at _ConsumerState__reader_closure.call$0 (https://mxotechaccountmanager.web.app/main.dart.js:149336:38)
main.dart.js:9844     at JsLinkedHashMap.putIfAbsent$2 (https://mxotechaccountmanager.web.app/main.dart.js:64594:24)
main.dart.js:9844     at _ConsumerState._reader$1$1 (https://mxotechaccountmanager.web.app/main.dart.js:149306:76)
main.dart.js:9844     at Object.eval [as call$1$1] (eval at Closure_forwardCallTo (https://mxotechaccountmanager.web.app/main.dart.js:7762:14), <anonymous>:3:43)
main.dart.js:9844     at _OverviewPaginatedTableState_build_closure.call$3 (https://mxotechaccountmanager.web.app/main.dart.js:79726:38)
main.dart.js:9844     at Consumer.build$2 (https://mxotechaccountmanager.web.app/main.dart.js:149242:28)
main.dart.js:9844     at _ConsumerState.build$1 (https://mxotechaccountmanager.web.app/main.dart.js:149288:28)
main.dart.js:9844     at StatefulElement.build$0 (https://mxotechaccountmanager.web.app/main.dart.js:136839:25)

Unfortunately, I can't recreate this error in a debug situation since it only happens when deployed. All of the other riverpod functionality works fine... however, this is the only place that I'm using multiple Providers within one Provider.

Any idea what's going on, or how I can better troubleshoot the problem?

1 Answer 1

1

This seems to be an error in the compiling to javascript. I was able to get my code working by removing the the 'autoDispose' in StreamProvider.autoDispose.family

this goes hand-in-hand with the message:

Unsupported operation: Unknown ProviderListenable AutoDisposeStreamProvider

I'm not sure if it's a Flutter error in transpiling, or, perhaps, a riverpod error. I'll put an issue in with riverpod so Remi can decide.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.