StaggeredGridView 未定义

StaggeredGridView is undefined

进口'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; //导入库

flutter_staggered_grid_view: ^0.5.0 // 包

    Flexible(
      child: Container(
        padding: EdgeInsets.only(top: 16.0, right: 16.0, left: 16.0),
        child: StaggeredGridView.countBuilder(
          physics: NeverScrollableScrollPhysics(),
          padding: EdgeInsets.zero,
          crossAxisCount: 4,
          itemCount: products.length,
          itemBuilder: (BuildContext context, int index) => new ClipRRect(
            borderRadius: BorderRadius.all(Radius.circular(5.0)),
            child: InkWell(
              onTap: () => Navigator.of(context).push(MaterialPageRoute(
                  builder: (_) => ProductPage(product: products[index]))),
              child: Container(
                  decoration: BoxDecoration(
                    gradient: RadialGradient(
                        colors: [
                          Colors.grey.withOpacity(0.3),
                          Colors.grey.withOpacity(0.7),
                        ],
                        center: Alignment(0, 0),
                        radius: 0.6,
                        focal: Alignment(0, 0),
                        focalRadius: 0.1),
                  ),
                  child: Hero(
                      tag: products[index].image,
                      child: Image.asset(products[index].image))),
            ),
          ),
          staggeredTileBuilder: (int index) =>
              StaggeredTile.count(2, index.isEven ? 3 : 2),
          mainAxisSpacing: 4.0,
          crossAxisSpacing: 4.0,
        ),
      ),
    ),

错误:

lib/screens/main/components/recommended_list.dart:51:20:错误:未为 class 'RecommendedList'.[=11 定义 getter 'StaggeredGridView' =]

使用版本:

dependencies:
  flutter_staggered_grid_view: ^0.4.0

该插件的 pub.dev 文档没有任何关于该方法在最新版本中被弃用或废弃的建议,即 flutter_staggered_grid_view 0.6.1。我尝试使用 flutter_staggered_grid_view: ^0.4.0 但这也不起作用。解决方法似乎是使用版本 0.3.1,然后识别 StaggeredGridView 方法。