You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When injecting blocs through ProxyProvider, you get the misleading error of BlocProvider.of() called with a context that does not contain a Bloc of type T, when the actual error is that provider sees a wrong type, being that bloc is a stream. It's not possible to use ListenableProxyProvider since bloc doesn't extend listenable and there's no StreamProxyProvider unfortunately.
Setting Provider.debugCheckInvalidValueType = null; in main() solves the issue, but this should probably be solved in a cleaner way.
Expected behavior
I'd expect to be able to retrieve without issues any bloc built using ProxyProvider or some flavor of it.
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.592], locale en-US)
• Flutter version 1.12.13+hotfix.5 at C:\src\flutter
• Framework revision 27321ebbad (7 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc2)
• Android SDK at C:\Users\roland.peres\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[√] VS Code, 64-bit edition (version 1.41.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.7.1
The text was updated successfully, but these errors were encountered:
Hey @felangel , this issue is to improve the error message, but also have a specialized proxy provider which could handle providing a bloc. This is probably something which provider should handle through a StreamProxyProvider.
narcodico
changed the title
Misleading error when providing blocs though ProxyProvider
Misleading error when providing blocs through ProxyProvider
Jan 29, 2020
Describe the bug
When injecting blocs through
ProxyProvider
, you get the misleading error ofBlocProvider.of() called with a context that does not contain a Bloc of type T
, when the actual error is that provider sees a wrong type, being that bloc is a stream. It's not possible to useListenableProxyProvider
since bloc doesn't extend listenable and there's noStreamProxyProvider
unfortunately.Setting
Provider.debugCheckInvalidValueType = null;
in main() solves the issue, but this should probably be solved in a cleaner way.https://gist.github.com/RollyPeres/7f181eebda7c33bb7aa2ce8dc5d3cfac
Expected behavior
I'd expect to be able to retrieve without issues any bloc built using
ProxyProvider
or some flavor of it.flutter doctor -v
The text was updated successfully, but these errors were encountered: