Reputation: 57
I am working on a Flutter app that uses Firebase and a Stream to show a list view if the data in Firebase is != null. If the data is null, I have my code display a loading sign. Whenever I launch my app, to begin with, the loading symbol is the first thing to come up and doesn't go away until I hot reload my app. When I hot restart again, I need to hot reload for the data to show up. If I ever publish my app will this issue come up for users or is it only because I am in Debug mode in my simulator? If this is an issue that may come up when the app is published, does anyone know how to fix this?
code:
Widget MemoirsList() {
return SingleChildScrollView(
child: memoirsStream != null
? Column(
children: <Widget>[
StreamBuilder(
stream: memoirsStream,
builder: (context, snapshot) {
return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 16),
itemCount: snapshot.data.documents.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return MemoirsCard(
authorName: snapshot.data.documents[index].data['authorName'],
title: snapshot.data.documents[index].data["title"],
description: snapshot.data.documents[index].data['description'],
imgUrl: snapshot.data.documents[index].data['imgURL'],
);
});
},
)
],
)
: Container(
alignment: Alignment.center,
child: CircularProgressIndicator(),
),
);
}
Upvotes: 0
Views: 113
Reputation: 577
It is definitely related to the Debug mode. I've been facing this issue a lot too. Try to build it in release mode and it should work fine. The app size of a debug build is large due to the debugging overhead that allows for hot reload and source level debugging.
When building a release version of your app, consider using the --split-debug-info
tag. This tag can dramatically reduce code size. For an example of using this tag, see Obfuscating Dart code.
Other things you can do to make your app smaller are:
To build a release version for Android
To build a release version for IOS
Upvotes: 1