What is the cause of this problem? When I click on the button to show the toast, this message appears
The following _CastError was thrown while handling a gesture: Null check operator used on a null value
*When the exception was thrown, this was the stack:
showToastWidget (package:flutter_styled_toast/src/styled_toast.dart:268:22)
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () {
showToast(txt,
context: context,
animation: StyledToastAnimation.slideFromLeft,
reverseAnimation: StyledToastAnimation.slideToBottom,
position: StyledToastPosition(
align: Alignment.bottomCenter, offset: 55),
animDuration: Duration(milliseconds: 300),
duration: Duration(seconds: 2),
curve: Curves.easeInOutBack,
reverseCurve: Curves.elasticIn,
backgroundColor: Color.fromRGBO(191, 21, 35, 0.5),
textStyle: TextStyle(fontSize: 20, color: Colors.white));
},
child: const Icon(Icons.add),
),
appBar: AppBar(title: Text('Flutter Code Sample')),
body: const Center(
child: MyStatelessWidget(),
),
),
);
}
}