[Solved] Flutter: A value of type 'ListTileThemeData' can't be assigned to a variable of type 'ListTileTheme'

Question

Asked by Josip D on December 11, 2021 (source).

I am posting this question to help future readers. After upgrading to Flutter 2.8 I suddenly got this error when trying to run my app:

Flutter: A value of type 'ListTileThemeData' can't be assigned to a variable of type 'ListTileTheme'.

How did I fix this?

Answer

Question answered by Josip D (source).

Turns out this error was caused by a popular library I used (settings_ui) that does not work with this version of Flutter (settings_ui: ^1.0.0).


For future readers: Use a later version of this package. There is currently an open issue on github that addresses this.


For people facing this issue now:

As a monkey patch you can follow the steps in the GitHub issue and edit the package files locally:

In cupertino_settings_item.dart change final ListTileTheme tileTheme = ListTileTheme.of(context); to final tileTheme = ListTileTheme.of(context);

And change _iconColor(ThemeData theme, ListTileTheme tileTheme) to _iconColor(ThemeData theme, ListTileThemeData tileTheme).

DART FLUTTER FLUTTER2.0 MOBILE
SHARE: