我需要输入日历类型的转换器才能添加会议室数据库。
错误:
无法弄清楚如何将该字段保存到数据库中。您可以 考虑为其添加类型转换器。
答案 0 :(得分:0)
在使用Room DB处理复杂数据时,您should write custom type converters。 请找到日期转换器的示例(它将日期转换为Long值并返回):
class ReversingScrollNotificationFilter
extends NotificationListener<ScrollNotification> {
final bool reverse;
final Widget child;
ReversingScrollNotificationFilter({this.reverse = true, @required this.child})
: super(
onNotification: (scrollNotification) {
print(scrollNotification.metrics.pixels);
ScrollNotification newNotification;
if (scrollNotification is ScrollStartNotification) {
newNotification = ScrollStartNotification(
metrics: FixedScrollMetrics(
pixels: scrollNotification.metrics.maxScrollExtent -
scrollNotification.metrics.pixels,
axisDirection: scrollNotification.metrics.axisDirection,
minScrollExtent:
scrollNotification.metrics.minScrollExtent,
maxScrollExtent:
scrollNotification.metrics.maxScrollExtent,
viewportDimension:
scrollNotification.metrics.viewportDimension),
context: scrollNotification.context,
dragDetails: scrollNotification.dragDetails);
} else {
return false;
}
newNotification.dispatch(newNotification.context);
return true; // cancel this notification because a new one was dispatched.
},
child: child);
}
此外,您可以参考this answer。