I was using the MaterialStateProperty
which is deprecated. So instead I updated it to WidgetStateProperty
. But then I get this error from my pipeline (build failed):
Error (Xcode): lib/ui/switch_button.dart Error: Type 'WidgetStateProperty' not found.
This is my code:
final WidgetStateProperty<Icon?> thumbIcon =
WidgetStateProperty.resolveWith<Icon?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) {
return const Icon(Icons.check);
}
return const Icon(Icons.close);
},
);
Or should I try to update Xcode maybe?
I saw a similar post about this where a guy said to use the deprecated MaterialStateProperty
or is this not the same issue?
Similar issue: Flutter Undefined name ‘WidgetStateProperty’