defaultError property

FlexSchemeColor defaultError

Return a copy of this FlexSchemeColor that will when used, result in a theme that use the Material Guide's default error color.

The error color is left out when the new object is created. This results in a copy where the scheme error color is null, this again will result in that a theme created from the color scheme will use the Material design guide's default and standard error color.

This function is useful if we want to create a dark scheme from a light scheme that already specifies the light scheme's error color, but we do not want a dark scheme where this light error color is used by toDark to compute an error color for the dark scheme, instead we prefer to use use the Material default dark mode error color.

This is demonstrated in example 5) where the toDark method is used, but we do not want use the already defined built-in light schemes' error colors for the computed dark schemes' error colors.

Generally if you make your own schemes and are satisfied with the Material default error color, you can omit defining it for the light scheme too. In that case it will remain null and get its default value, and likewise for the dark scheme. Example 5, the three custom schemes uses this setup.

If you in example 5 remove the defaultError before the toDark, you will notice that dark scheme's from the built-in schemes get a dark scheme where the error color changes when you use the "Compute dark theme" feature and the white blend "level" slider. Whereas, the custom example schemes that had no error color specified for their light scheme, still get the fixed default dark error color, as when we used this defaultError feature.

Implementation

FlexSchemeColor get defaultError {
  return FlexSchemeColor(
    primary: primary,
    primaryVariant: primaryVariant,
    secondary: secondary,
    secondaryVariant: secondaryVariant,
    appBarColor: appBarColor,
  );
}