[英]Flutter streambuilder has no data in release mode
由於某種原因,我的應用程序在配置文件/發布版本上無法正常工作。
@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;
基本上快照在配置文件/發布模式下沒有數據,但在調試模式下很好......配置文件模式僅返回 1 和 2,我一直看到 CircularProgressIndicator。 而調試模式返回 1-2-3 和正確的數據。 有誰知道可能是什么原因?
請提供更多信息:
widget._eventStream
如何獲取數據? 首先,我猜你從 HTTP 或 WebSocket 上獲得了 stream 的數據。 其次,如果問題僅出現在 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.