[英]Cannot use data from GraphQl query after getting data using Flutter and Ferry
[英]Cant use flutter DateTime in ferry query
這是查詢
query UpcomingPendingEvents($attendantId: ID, $eventDateTimeGt: DateTime) {
attendances(attendant_Id: $attendantId, attending: "0",
event_Datetime_Gt: $eventDateTimeGt, first: 10,) {
# some fields here
}
}
我收到錯誤A value of type 'DateTime' can't be assigned to a variable of type 'GDateTimeBuilder?'
當我使用以下查詢時
gqlClient.request(GUpcomingPendingEventsReq(
(b) => b
..vars.attendantId = attendantId
..vars.eventDateTimeGt = DateTime.parse('2021-12-15T17:00:00'),
));
當我嘗試那樣使用它時。
gqlClient.request(GUpcomingPendingEventsReq(
(b) => b
..vars.attendantId = attendantId
..vars.eventDateTimeGt = DateTime.parse('2021-12-15T17:00:00') as GDateTimeBuilder?,
));
我收到運行時錯誤type 'DateTime' is not a subtype of type 'GDateTimeBuilder?' in type cast
type 'DateTime' is not a subtype of type 'GDateTimeBuilder?' in type cast
。
我認為您需要將其分配給GDateTimeBuilder
上的value
。
...
(b) => b
..vars.attendantId = attendantId
..vars.eventDateTimeGt.value = '2021-12-15T17:00:00' // <-- here
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.