I am trying to run this code example https://pub.dev/packages/flutter_adaptive_scaffold/example
but the code does not compile showing Undefined name 'WidgetStateProperty'
.
Have tried restarting VS Code and flutter clean/get
– not helpful.
Also, tried to copy WidgetStateProperty
class into my project, but then I got WidgetState is not a type
.
I searched and found this issue https://github.com/hiddify/hiddify-next/issues/946 which seems to be somehow similar but not helpful.
I am on Windows using the latest versions of VS Code, Dart and Flutter
Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.19045.4412], locale en-US)
Any ideas?
2
Answers
I ran Debug - and got a message that errors exist in the project do you like to debug anyway - Yes, then the project is properly built and errors disappear.
As of version 3.22,
MaterialStateProperty
is deprecated. We should useWidgetStateProperty
instead.But if you’re using version 3.19 or lower, you can use
MaterialStateProperty
instead.