参考 dart3.0使用flutter_swiper报错记录
flutter_swiper package - All Versions从官网的信息可以看到 Dart3版本不兼容 最小兼容的Dart SDK版本需要2.0
Flutter SDK 版本列表Flutter SDK 版本列表 - Flutter 中文文档 - Flutter 中文开发者网站 - Flutter
说明:因为flutter_swiper不兼容dart版本3.0 所以我们使用flutter_swiper_null_safety | Flutter Package替代它
将此包用作库
依赖它
运行此命令:
$ flutter pub add flutter_swiper_null_safety
这将向你的包的pubspec.yaml添加一行代码(并运行一个隐式的flutter pub get
):
dependencies:flutter_swiper_null_safety: ^1.0.2
将其导入
在Dart代码中,您可以使用:
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';