我正在嘗試在 Flutter 上開發一個庫存管理應用程式。我已將 Firebase 集成到應用程式中,并且可以查看應用程式上的資料。我的收藏和檔案如下:

資料庫中有不同日期添加的產品,但我想過濾今天添加的產品。當我輸入這樣的查詢時沒有找到產品:
var response = await FirebaseFirestore.instance
.collection('sayim')
.where('sirket', isEqualTo: sirket)
.where('tarih', isLessThanOrEqualTo: DateTime.now())
.where('tarih', isGreaterThanOrEqualTo: DateTime.now().day - 1)
.get();
我想列出從一天開始到現在的所有產品。我應該如何編輯查詢?
uj5u.com熱心網友回復:
從現在開始創建一個新日期
DateTime now = new DateTime.now();
DateTime date = new DateTime(now.year, now.month, now.day);
并在您的查詢中使用它
var response = await FirebaseFirestore.instance
.collection('sayim')
.where('sirket', isEqualTo: sirket)
.where('tarih', isLessThanOrEqualTo: now)
.where('tarih', isGreaterThanOrEqualTo: date)
.get();
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/526223.html
標籤:Google Cloud Collective 扑火力基地镖谷歌云火库
上一篇:如何在顫振中通過參考傳遞函式?
