I want to fetch all orders based on the value of date variable.
Here's the function I am using to fetch:
Future<void> fetchAllOrders() async {
var now = DateTime.now();
var today = now.day.toString()+now.month.toString()+now.year.toString();
print('Todays time is ' + today.toString());
var filterString ='orderBy="date"&equalTo="$today"';
final url = 'https://tm-9120.firebaseio.com/ordersdev.json?auth=$authToken&$filterString';
final response = await http.get(Uri.parse(url));
final data = json.decode(response.body) as Map<String, dynamic>;
print(data);
}
Here's the structure of my realtime database table:
ordersdev -> userId -> order object containing date variable
The function returns null. What am I missing?