stream-builder

StreamBuilder in Flutter stuck with ConnectionState.waiting and displays only the loading mark

社会主义新天地 提交于 2020-05-15 18:21:05
问题 Hi I am trying to display the data inside the Firebase documents into my Flutter dynamically where they get rendered using a loop, so I made a List<Widget> Cards and added to it the function makeItem() that contains the cards, and put them inside a loop, so the problem is that when I run the code it outputs print(snapshot.connectionState); as ConnectionState.waiting all the time and it should be async snapshot yet it refuses to load the data as required, I should mention that the data is

flutter how to make gridview show firebase data like buttons

不羁岁月 提交于 2019-12-24 07:23:51
问题 I am trying to user Streambuilder to display gridview, but it return this error, I am calling the method classList() to container in scaffold body database = FirebaseDatabase.instance I want to show classData, show 0,1,2..etc I want to show ('className','classSection' in one button per child) in gridview as RaisedButtons I get this error when the code below is executed I/flutter ( 5433): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I

TextField with initial value inside StreamBuilder

拈花ヽ惹草 提交于 2019-12-11 07:53:10
问题 We are creating an user's editing data page, so the textfield already comes filled with the user data and users can change and save it... The problem is that when I start to enter character into textfield, the cursor get lost, every character that I enter (from the device keyboard), the cursor goes to the first character... and if I remove the controller with my initial value, it works fine, but then I can not have my textfield filled with the users data. Code sample: child: StreamBuilder

Flutter - StreamBuilder builder function runs when navigator pops

余生颓废 提交于 2019-12-11 06:22:57
问题 I have a widget called RootContainer which receives a Widget child and wrap it inside a StreamBuilder : class RootContainer extends StatelessWidget { final Widget child; RootContainer({this.child}); @override Widget build(BuildContext context) { return StreamBuilder<OverlayAlert>( stream: ApiService.ThrottledException.stream, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.active) { Future.delayed(Duration.zero, () => showAlert(context, snapshot)); } return this

How to show different Widget when user is offline while using StreamBuilder?

拈花ヽ惹草 提交于 2019-12-10 17:48:05
问题 I am trying to fetch some data from the internet. With the use of FutureBuilder , handling for various cases like offline, online,error is quite easy but I am using StreamBuilder and I am not able to understand how to handle offline case Following is my code to use StreamBuilder which works but I have not handled offline data or error return StreamBuilder( builder: (context, AsyncSnapshot<SchoolListModel> snapshot) { if (snapshot.hasError) { return Expanded( child: Center( child: Text

Flutter Stream Builder Triggered when Navigator Pop or Push is Called

房东的猫 提交于 2019-12-06 07:53:30
问题 I have a stream builder in the app's home/root page. This stream builder gets triggered whenever I do a page-navigation elsewhere, which has nothing to do with the stream itself. My understanding, according to here and here, is when a page is popped/pushed in the navigator, it triggers a rebuild on the app, so the stream builder gets re-attached and so it fires. However this seems inefficient, so is there a way to prevent the stream builder from firing when a page is popped/pushed?

Flutter Stream Builder Triggered when Navigator Pop or Push is Called

烈酒焚心 提交于 2019-12-04 13:53:59
I have a stream builder in the app's home/root page. This stream builder gets triggered whenever I do a page-navigation elsewhere, which has nothing to do with the stream itself. My understanding, according to here and here , is when a page is popped/pushed in the navigator, it triggers a rebuild on the app, so the stream builder gets re-attached and so it fires. However this seems inefficient, so is there a way to prevent the stream builder from firing when a page is popped/pushed? Additionally, according to the logs, when I push a page, the page is built and shown first, then the stream