Almost every time I run my project in debug mode in VS Code, I get this error: TypeError: Cannot read properties of undefined (reading 'OverviewCard')
(OverviewCard
is a custom widget I created). The widget mentioned after the “reading” part is almost always random — sometimes it even blames MaterialApp
.
There’s nothing wrong with my code, as it occasionally runs perfectly fine. But the moment I close the application and rerun it, the error comes back. I’ve tried all the usual fixes – restarting VS Code, restarting the project, running flutter clean
, and flutter pub get
. Sometimes, one of these options works, but mostly it just changes the widget after the “reading” part in the error.
I suspect it might have something to do with how Flutter is set up on my Linux system, but I haven’t been able to figure it out yet.
I’ve attached an image of the error: