firestore_ui 1.6.0

firestore_ui #

pub package

This project started as a Pull Request to the official cloud_firestore plugin, but unfortunately they are still polishing the main features and this had to be postponed.

But fear not, my fellow Cloud Firestore users, this is a package that extracted the main code from that PR and now it's available to use!

Check out the example for more info, it should be pretty straight forward since it's just a port of firebase_database's version.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[1.6.0] - 2019-06-04

  • Updates to the filter mechanism, it would hide items due to an index mismanagement
  • Updated cloud_firestore to 0.12.2

[1.5.0] - 2019-05-09

  • Added filter parameter that takes out data if it returns true for that DocumentSnapshot
  • Updated cloud_firestore to 0.12.0

[1.4.0] - 2019-05-09

  • Changed dependency requirements

[1.3.0] - 2019-04-30

  • Added onLoaded method for when you need to interact directly with the QuerySnapshot that came from the stream
  • Bump cloud_firestore dependency version to 0.10.0

[1.2.0] - 2019-02-08

  • Bump cloud_firestore dependency version to 0.9.0

[1.1.1] - 2019-01-14

  • Updated setState calls, should be faster to show values

[1.1.0] - 2019-01-03

  • Added onLoaded callback to FirestoreList
  • Fixed flashing of emptyChild when setted
  • Minor general fixes, better debugging if debug is set true

[1.0.1] - 2018-10-09

  • Fixed some errors on the README and package description

[1.0.0] - 2018-10-09


// Copyright 2017, the Chromium project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:firebase_core/firebase_core.dart'
    show FirebaseApp, FirebaseOptions;
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firestore_ui/animated_firestore_list.dart';

final String title = 'firestore_ui example';

Future<void> main() async {
  final FirebaseApp app = await FirebaseApp.configure(
    name: 'test',
    options: const FirebaseOptions(
      googleAppID: '1:79601577497:ios:5f2bcc6ba8cecddd',
      gcmSenderID: '79601577497',
      apiKey: 'AIzaSyArgmRGfB5kiQT6CunAOmKRVKEsxKmy6YI-G72PVU',
      projectID: 'flutter-firestore',
  final Firestore firestore = Firestore(app: app);

  runApp(MaterialApp(title: title, home: MyHomePage(firestore: firestore)));

class MessageItem extends StatelessWidget {
  final int index;
  final DocumentSnapshot document;
  final Function(DocumentSnapshot) onTap;

  const MessageItem({
    Key key,
  }) : super(key: key);

  Widget build(BuildContext context) {
    return ListTile(
      title: Text(document['message'] ?? '<No message retrieved>'),
      subtitle: Text('Message ${this.index + 1}'),
      onTap: () => onTap(this.document),

class MyHomePage extends StatelessWidget {
  final Firestore firestore;
  CollectionReference get messages => firestore.collection('messages');

  Future<Null> _addMessage() async {
    final DocumentReference document = messages.document();
    document.setData(<String, dynamic>{
      'message': 'Hello world!',

  Future<Null> _removeMessage(DocumentSnapshot snapshot) async {
    await firestore.runTransaction((transaction) async {
      await transaction.delete(snapshot.reference).catchError(
          (exception, stacktrace) => print("Couldn't remove item: $exception"));

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      body: FirestoreAnimatedList(
        query: firestore.collection('messages').snapshots(),
        itemBuilder: (
          BuildContext context,
          DocumentSnapshot snapshot,
          Animation<double> animation,
          int index,
        ) {
          return FadeTransition(
            opacity: animation,
            child: MessageItem(
              index: index,
              document: snapshot,
              onTap: _removeMessage,
      floatingActionButton: FloatingActionButton(
        onPressed: _addMessage,
        tooltip: 'Increment',
        child: const Icon(Icons.add),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firestore_ui: ^1.6.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firestore_ui/firestore_ui.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/firestore_list.dart. (-0.50 points)

Analysis of lib/firestore_list.dart reported 1 hint:

line 156 col 47: Avoid using braces in interpolation when not needed.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (meta).

The package description is too short. (-10 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
cloud_firestore ^0.12.2 0.12.7
firebase_core ^0.4.0+3 0.4.0+7
flutter 0.0.0
meta ^1.1.6 1.1.6 1.1.7
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies