pubspec. yaml添加行
依赖性:
Flutter :
sdk:扑动
同步_Flutter_日历:四月二十日
在主. dart文件中添加了以下链接的日历代码,运行应用程序时https://pub.dev/packages/syncfusion_flutter_calendar/example出现以下错误。
/C:/flutter/. pub-cache/hosted/www.example.com错误:无法将参数类型"ScrollableState?"赋给参数类型"ScrollableState",因为"ScrollableState?"可以为null,而"ScrollableState"不能为null。pub.dartlang.org/syncfusion_flutter_datepicker-20.4.50/lib/src/date_picker/date_picker.dart:7596:37: Error: The argument type 'ScrollableState?' can't be assigned to the parameter type 'ScrollableState' because 'ScrollableState?' is nullable and 'ScrollableState' isn't.
- "可滚动状态"来自"软件包:flutter/src/widgets/可滚动. dart"("/C:/flutter/软件包/flutter/lib/src/widgets/可滚动. dart ")。可滚动状态:可滚动. of(上下文),
如何解决这个问题?
1条答案
按热度按时间neekobn81#
当前调试器显示上述错误,因为您尝试将值(
ScrollableState?
,末尾的问号表示它可以为空)分配给仅接受非空值(ScrollableState
)的参数。如果您确定参数不能为空,则可以在结尾处为其指定一个
!
标记。例如: