Reputation: 3064
I'd like to know how to rebuild the FirebaseAnimatedList with a new query, new content changing the path.
new Flexible(
child: new FirebaseAnimatedList(
query: query,
sort: (DataSnapshot a, DataSnapshot b) =>
b.key.compareTo(a.key),
itemBuilder: (BuildContext context, DataSnapshot snapshot,
Animation<double> animation, int index) {...})
When i change the query in realtime it not changes the result in the list:
setState(() {
query = "another/path";
});
Upvotes: 4
Views: 1807
Reputation: 3064
I got it working changing the Key each time i change the query, i not sure if is the best way, but is working:
new Flexible(
child: new FirebaseAnimatedList(
key: _key,
query: query,
sort: (DataSnapshot a, DataSnapshot b) =>
b.key.compareTo(a.key),
itemBuilder: (BuildContext context, DataSnapshot snapshot,
Animation<double> animation, int index) {...})
setState(() {
query = "another/path";
_key = Key('anotherkey');
});
Upvotes: 5