首页 > 解决方案 > 为什么每次使用 SfCalendar() Widget 时都会出错?我已经输入了依赖项

问题描述

“发生异常。FlutterError(无法加载资产:packages/timezone/data/2020a.tzf)”。我不能简单地运行 SfCalendar 小部件。这是我的代码:

    return Scaffold(
  backgroundColor: Colors.transparent,
  appBar: AppBar(
    title: Text(
      'Calendar View',
      style: TextStyle(fontSize: 22, fontWeight: FontWeight.w500),
    ),
    centerTitle: true,
    backgroundColor: Color(0xFF57A0D3),
    elevation: 0.0,
  ),
  body: Container(
    child: SfCalendar(
      view: CalendarView.month,
    ),
  ),
);

标签: flutter

解决方案


执行flutter clean并重新启动应用程序,然后flutter pub get在终端中执行。它对我有用


推荐阅读