Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The firebase RTDB data fetching issue from the "FirebaseAnimatedList" function code #12635

Closed
4444monkey opened this issue Apr 12, 2024 · 2 comments
Labels
platform: all Issues / PRs which are for all platforms. plugin: database resolution: solution-provided A solution has been provided in the issue.

Comments

@4444monkey
Copy link

4444monkey commented Apr 12, 2024

Hi There,
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).
S__81338371

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

@russellwheatley
Copy link
Member

@4444monkey - It must have 9 data nodes in the root of the RTDB data node. This query:

FirebaseDatabase.instance.ref();

is a reference to the root of your data.

@russellwheatley russellwheatley added plugin: database resolution: solution-provided A solution has been provided in the issue. platform: all Issues / PRs which are for all platforms. labels Apr 16, 2024
@4444monkey
Copy link
Author

4444monkey commented Apr 16, 2024

Yes, there are 9 variables on the RTDB.
However, I was wondering why it repeatedly showed 9 times of the display by using the FirebaseAnimatedList function.
I was able to read the individual data under a specific child path, but now I cannot.

@firebase firebase locked and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: all Issues / PRs which are for all platforms. plugin: database resolution: solution-provided A solution has been provided in the issue.
Projects
None yet
Development

No branches or pull requests

2 participants