title: How to check that the firebase RTDB date equal to the date i have given through the date picker
body: <p><a href="https://i.stack.imgur.com/3yBsn.png" rel="nofollow noreferrer">This is the Database</a>  Here is the code that I have taken the count of Orders that which the &quot;IsDelivered&quot; value is true and false separately.</p>
  <pre><code>**dasboard.dart.**
  
  import 'package:easyway/future.dart';
  import 'package:firebase_database/ui/firebase_animated_list.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter/rendering.dart';
  import 'package:intl/intl.dart';
  import 'package:firebase_core/firebase_core.dart';
  import 'package:firebase_database/firebase_database.dart';
  
  
  class Dashboard extends StatefulWidget {
    static DateTime _date;
    Dashboard({this.app});
    final FirebaseApp app;
  
    @override
    _DashboardState createState() =&gt; _DashboardState();
  }
  
  class _DashboardState extends State&lt;Dashboard&gt; {
    final _referenceData = FirebaseDatabase.instance;
    final databaseRef = FirebaseDatabase.instance.reference()
        .child('orders')
        .orderByChild('isDelivered');
   Query dataRef;
    Map myList = {};
    String name;
  
    @override
    void initState() {
      dataRef =
          FirebaseDatabase.instance.reference().child('orders').orderByChild(
              'deliveryDate');
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) {
      print(dataRef);
      // Widget buildorder({Map orders,int count}){
      //   return Center(child: Text(orders['isDelivered'].toString(),style: TextStyle(fontSize: 30,fontWeight: FontWeight.bold),));
      // }
      // final ref = _referenceData.reference();
      var _height = MediaQuery
          .of(context)
          .size
          .height;
      var _width = MediaQuery
          .of(context)
          .size
          .width;
  
      return Scaffold(
        appBar: AppBar(
          title: Text(&quot;DashBoard&quot;, style: TextStyle(
              color: Colors.black
          ),),
          backgroundColor: Colors.white,
        ),
        body: ListView(
          children: [
            Padding(
              padding: const EdgeInsets.all(29.0),
              child: GestureDetector(
                onTap: () {
                  showDatePicker(context: context,
                      initialDate: Dashboard._date == null
                          ? DateTime.now()
                          : Dashboard._date,
                      firstDate: DateTime(2018),
                      lastDate: DateTime(2022)
                  ).then((value) {
                    setState(() {
  
                      Dashboard._date = value;
                    });
                  });
                },
                child: Container(
                  height: _height * .15,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      color: Colors.blue,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black38,
                          blurRadius: 3,
                          spreadRadius: 3,
                          offset: Offset(4.0, 4.0),
                        )
                      ]
                  ),
                  padding: EdgeInsets.all(10),
  
                  child: FittedBox(
                    child: Text(
                      Dashboard._date == null ? DateFormat.yMMMMEEEEd().format(
                          DateTime.now()).toString() : DateFormat.yMMMMEEEEd()
                          .format(Dashboard._date)
                          .toString(),
                      style: TextStyle(fontSize: 20,
                          color: Colors.white,
                          fontWeight: FontWeight.bold),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 29, right: 14),
              child: Text(&quot;Production Efficiency &amp; Order Taken&quot;, style: TextStyle(
                  fontWeight: FontWeight.bold, fontSize: 23, fontFamily: 'Lato'
              ),),
            ),
            Padding(
              padding: const EdgeInsets.all(25.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  Container(
                    height: _height * .3,
                    width: _width * .4,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.yellow,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black38,
                          blurRadius: 2,
                          spreadRadius: 2,
                          offset: Offset(4.0, 4.0),
                        )
                      ],
                    ),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          &quot;Total Hours&quot;, style: TextStyle(
                            fontWeight: FontWeight.bold,
                            fontSize: 26,
                            color: Colors.lightBlue,
                            fontFamily: 'Lato'),
                        ),
                        SizedBox(height: 20,),
                        Text(&quot;25&quot;, style: TextStyle(
                            fontSize: 30, fontWeight: FontWeight.bold),),
                        Divider(
                          color: Colors.white,
                          indent: _height / 13,
                          endIndent: _width / 8,
                          thickness: 4,
                        ),
                        Text(&quot;30&quot;, style: TextStyle(
                            fontSize: 30, fontWeight: FontWeight.bold),)
  
                      ],
                    ),
                  ),
                  SizedBox(width: 25,),
                  Container(
                    height: _height * .3,
                    width: _width * .4,
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(20),
                        color: Colors.yellow,
                        boxShadow: [
                          BoxShadow(
                            color: Colors.black38,
                            blurRadius: 2,
                            spreadRadius: 2,
                            offset: Offset(4.0, 4.0),
                          )
                        ]
                    ),
                  ),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(
                  left: 29, right: 29, top: 20, bottom: 29),
              child: Dashboard._date == null ?SampleClass(
                height: _height*.35,
                length: 'Delivered :',
                length1: &quot;Postponed :&quot;,
                source: databaseRef.equalTo(true).once(),
                source1: databaseRef.equalTo(false).once(),
              ):Container()
            )
          ],
        ),
      );
    }
  }
  
  **future.dart.**
  
  import 'package:easyway/dashboard.dart';
  import 'package:flutter/material.dart';
  import 'package:firebase_core/firebase_core.dart';
  import 'package:firebase_database/firebase_database.dart';
  
  class SampleClass extends StatefulWidget {
    final double height;
    final String length;
    final Future&lt;DataSnapshot&gt; source;
    final String length1;
    final Future&lt;DataSnapshot&gt; source1;
  
    const SampleClass({Key key,this.height,this.length,this.source,this.length1,this.source1}):super(key:key);
    @override
    _SampleClassState createState() =&gt; _SampleClassState();
  }
  
  class _SampleClassState extends State&lt;SampleClass&gt; {
    Dashboard date = Dashboard();
    final databaseRef = FirebaseDatabase.instance.reference()
        .child('orders')
        .orderByChild('isDelivered');
    final datarF = FirebaseDatabase.instance.reference().child('orders').orderByChild('deliveryDate');
    final Future&lt;FirebaseApp&gt; _future = Firebase.initializeApp();
   static List&lt;Map&lt;dynamic, dynamic&gt;&gt; lists = [];
    static Widget future({String length,Future&lt;DataSnapshot&gt; source}){
      return FutureBuilder(
        future: source,
        builder: (context,AsyncSnapshot&lt;DataSnapshot&gt; snapshot){
          if(snapshot.hasData){
            lists.clear();
            Map&lt;dynamic,dynamic&gt; values = snapshot.data.value;
            values.forEach((key, value) {
              lists.add(values);
            });
            return Container(
              child: Text(length+lists.length.toString(),style: TextStyle(fontSize: 35,fontWeight: FontWeight.bold),),
            );
          }else{
            return CircularProgressIndicator();
          }
        },
      );  }
    @override
    Widget build(BuildContext context) {
      return Container(
          height: widget.height,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              color: Colors.blue,
              boxShadow: [
                BoxShadow(
                  color: Colors.black38,
                  blurRadius: 3,
                  spreadRadius: 3,
                  offset: Offset(4.0, 4.0),
                )
              ]
          ),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              future(
                  length: widget.length,
                  source: widget.source,
              ),
              future(
                length: widget.length1,
                source: widget.source1,
              ),
              FutureBuilder(
                future: datarF.equalTo(&quot;17/03/2021&quot;).once(),
                builder: (context,AsyncSnapshot&lt;DataSnapshot&gt; snapshot){
                  if(snapshot.hasData){
                    lists.clear();
                    Map&lt;dynamic,dynamic&gt; values = snapshot.data.value;
                    values.forEach((key, value) {
                     if(values!=null){
                       lists.add(values);
                     }else{
                       lists.length = 0;
                     }
                    });
                    return Text(values['deliveryDate'].toString(),style: TextStyle(fontSize: 35,fontWeight: FontWeight.bold),);
                  }else{
                    return CircularProgressIndicator();
                  }
                },
              )
            ],
          )
      );
    }
  }
  </code></pre>
  <p>How to check that the firebase RTDB date equal to the date I have given through the date picker and I want to take the count of orders &quot;isDElivered&quot; value that was equal to the date chosen through the date picker.</p>
  <p>How do I get the solution please help me to solve this?</p>