0

这是查询

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

4

1 回答 1

0

我认为您需要将其分配valueGDateTimeBuilder.

 ...
 (b) => b
 ..vars.attendantId = attendantId
 ..vars.eventDateTimeGt.value = '2021-12-15T17:00:00' // <-- here
 ...
于 2022-02-18T12:14:12.120 回答