Replies: 2 comments 1 reply
-
This feature is now implemented in version 6.1, for all properties expect booleans that for the moment at least are planned to be kept as none nullable. There are some use cases where having them nullable would enable more flexible default behavior between M2 and M3 modes, but I have been able to work around them so far. |
Beta Was this translation helpful? Give feedback.
-
Version 7 made a few bools null by default as well, but only for a few cases where it was needed to have different default boolean value in M2 and M3 mode. But for features that don't need it, they have same default value in M2 and M3 mode, they will remain non nullable for now. For a long time the Themes Playground local persistence model did not support persisting null value for booleans, but now it does that as well. |
Beta Was this translation helpful? Give feedback.
-
Currently many properties in
FlexSubThemesData
are none nullable and use default values.Flutter
ThemeData
uses all nullable values and theme defaults depend on different behavior depending on different situations.In some cases
FlexSubThemesData
had to migrate to use nullable defaults and behavior driven default values to support different defaults in different situation (M2 vs M3 defaults). The style mix is a bit inconsistent. Would it be clearer if they were all nullable?The none nullable props have the advantage that you see the default conveniently in the constructor, whereas for the nullable ones, you have to look up the default behavior in the code. Although FlexColorScheme does include the default values mentioned in the docs.
Currently the strategy is and has been to move them to be nullable when there is need for it.
2 votes ·
Beta Was this translation helpful? Give feedback.
All reactions