import 'package:flutter/material.dart';
class OpeningHoursSettings extends StatelessWidget {
final Function(bool?)? onSliderChanged;
const OpeningHoursSettings({
super.key,required this.onSliderChanged,
});
///.....
RangeSlider _buildSlider(BuildContext context){
return RangeSlider(divisions: 24,values:
RangeValues(
openingHours.openAt,
openingHours.closeAt),min: 0, max: 0,
**onChanged: onSliderChanged**
);
}
I have made the problem part bold.
The error thrown is
The argument type 'dynamic Function(bool?)?' can't be assigned to the parameter type 'void Function(RangeValues)?'.dartargument_type_not_assignable
I read the docs of null safety but in vain
If you check the definition of
RangeSlider(onChangedit isSo you can change the function dataType like,