multi_query_firestore 2.0.0 copy "multi_query_firestore: ^2.0.0" to clipboard
multi_query_firestore: ^2.0.0 copied to clipboard

outdated

The best way to create multiple queries in the firestore with various conditions.

example/main.dart

import 'package:multi_query_firestore/multi_query_firestore.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final _fs = FirebaseFirestore.instance;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: StreamBuilder<QuerySnapshot>(
        stream: MultiQueryFirestore(list: [
          _fs.collection('users').where('age', isLessThan: 10),
          _fs.collection('users').where('age', isGreaterThan: 20),
          _fs.collection('people').where('height', isGreaterThan: 172)
        ]).snapshots(),
        builder: (c, s) {
          if (s.connectionState != ConnectionState.done) {
            return Center(child: CircularProgressIndicator());
          }

          final list = s.data.docs;

          return ListView.builder(
              itemCount: list.length,
              itemBuilder: (c, i) =>
                  ListTile(title: Text(list[i].data()['name'])));
        },
      ),
    );
  }
}
10
likes
40
pub points
0%
popularity

Publisher

verified publishercleancode.dev

The best way to create multiple queries in the firestore with various conditions.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

cloud_firestore, flutter, rxdart

More

Packages that depend on multi_query_firestore