The firebase RTDB data fetching issue from the "FirebaseAnimatedList" function code #12635
Labels
platform: all
Issues / PRs which are for all platforms.
plugin: database
resolution: solution-provided
A solution has been provided in the issue.
Hi There,
![S__81338371](https://private-user-images.githubusercontent.com/136068099/322006427-8fb370fe-4584-493e-b0c8-17a5debd99e9.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NTYxMjEsIm5iZiI6MTcyMTc1NTgyMSwicGF0aCI6Ii8xMzYwNjgwOTkvMzIyMDA2NDI3LThmYjM3MGZlLTQ1ODQtNDkzZS1iMGM4LTE3YTVkZWJkOTllOS5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyM1QxNzMwMjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mYzhiNTAyNDE5MzZlM2RlNDE3MmY2YmY1NzhkYWVhNGY1NDcxODczNmMxYjJmMjMxNjVjZDY3MjkwODg1ODJiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.rDxCR2N63cKVFkWrYFB-HhAXfSOGlq2oOBkAOFz_Qzk)
I hope I could have any advice regarding the weird display on the Android mobile system.
The issue I found was related to the function "FirebaseAnimatedList" that I called and tried to read the real-time data update from Firebase RTDB. I was sure everything went smoothly couple weeks ago, and no abnormal display was observed as well. Somehow, I re-tested it and found the abnormal display with the iterative wordings. I am confused about why it suddenly became this (picture was attached).
Other configurations were correctly set up following the website. Dependencies are up to date.
coding environment: Windows-VScode, Flutter kit, dart code
The code is as follows (I just simplified it):
//===================================================
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_database/ui/firebase_animated_list.dart';
import 'package:flutter/material.dart';
class DataPage extends StatefulWidget {
const DataPage({Key? key, required this.title}) : super(key: key);
final String title;
@OverRide
State createState() => _DataPageState();
}
class _DataPageState extends State {
// Get the Stream
final DatabaseReference _userRef = FirebaseDatabase.instance.ref();
@OverRide
void initState() {
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 166, 224, 211),
appBar: AppBar(
centerTitle: true,
title: const Text("RTDB Data Fetching"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: FirebaseAnimatedList(
query: _userRef,
itemBuilder: (context, snapshot, animation, index) {
// Replace the placeholder 'Test' with actual data from the snapshot
return Container(
child: Text('Test'),
);
},
),
),
],
),
);
}
}
Originally posted by @4444monkey in #12634
The text was updated successfully, but these errors were encountered: