I am getting this error when I tried calling class this way, the error is caused by UserThreads(scrollController: _scrollController), call. I have also included the userThread class code snipet here:
//Tab view
SizedBox(
height: 1000,
child: const TabBarView(
children: [
UserThreads(scrollController: _scrollController),
UserReplies(),
UserMedia(),
],
),
),
The constructor being called isn’t a const constructor.
Try removing ‘const’ from the constructor invocation.dartconst_with_non_const
{required dynamic scrollController}
Type: dynamic
UserThread Class code
class UserThreads extends StatefulWidget {
final scrollController;
UserThreads({
required this.scrollController
});
@override
State<UserThreads> createState() => _UserThreadsState();
}
class _UserThreadsState extends State<UserThreads> {
//Initialize all variables
int? userID;
String? sessionData;
@override
Widget build(BuildContext context) {
var scrollController = widget.scrollController;
return ListView(
controller: scrollController,
children: [