[英]Flutter streambuilder has no data in release mode
My application for some reason isn't working correctly on profile/release version.由于某种原因,我的应用程序在配置文件/发布版本上无法正常工作。
@override
Widget build(BuildContext context) {
print('1');
final userData = context.watch<UserModel>();
return StreamBuilder<List<AppointmentModel>>(
stream: widget._eventStream as Stream<List<AppointmentModel>>,
builder: (context, snapshot) {
print('2');
if (!snapshot.hasData) return const CircularProgressIndicator();
if (snapshot.hasData) {
print('3');
final events = snapshot.data;
basically the snapshot has no data in profile/release mode but in debug mode it's fine... profile mode returns 1 and 2 only and i keep seeing CircularProgressIndicator.基本上快照在配置文件/发布模式下没有数据,但在调试模式下很好......配置文件模式仅返回 1 和 2,我一直看到 CircularProgressIndicator。 while debug mode returns 1-2-3 and correct data.
而调试模式返回 1-2-3 和正确的数据。 Anyone know what could be the cause?
有谁知道可能是什么原因?
Please provide more information:请提供更多信息:
widget._eventStream
gets the data? widget._eventStream
如何获取数据? First, I can guess that you get data for the stream from some backed over HTTP or WebSocket.首先,我猜你从 HTTP 或 WebSocket 上获得了 stream 的数据。 Second, if the problem is only on Android, make sure that in the
AppManifest.xml
files under /android/app/src/profile
and /android/app/src/main
, you have the next line of code for permission:其次,如果问题仅出现在 Android 上,请确保在
/android/app/src/profile
和/android/app/src/main
下的AppManifest.xml
文件中,您有下一行代码以获得权限:
<uses-permission android:name="android.permission.INTERNET"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.