如何在使用自定义画家制作绘图板时为 onPanEnd 赋予空值
how to give a null value to onPanEnd while making a drawpad using custom painter
onPanEnd: (details) {
pointsList.add(null);
pointsStream.add(pointsList);
},
class DrawModel {
final Offset offset;
final Paint paint;
DrawModel({required this.offset, required this.paint});
}
错误:无法将参数类型 'Null' 分配给参数类型 'DrawModel
这是您要找的吗?
List<DrawModel?> pointList = [];
onPanEnd: (details) {
pointsList.add(null);
pointsStream.add(pointsList);
},
class DrawModel {
final Offset offset;
final Paint paint;
DrawModel({required this.offset, required this.paint});
}
错误:无法将参数类型 'Null' 分配给参数类型 'DrawModel
这是您要找的吗?
List<DrawModel?> pointList = [];