ThemeColors.parse constructor
ThemeColors.parse(
- Object? source
Implementation
factory ThemeColors.parse(Object? source) {
if (source is! Map) return ThemeColors();
try {
final primary = source['primary'];
final secondary = source['secondary'];
final tertiary = source['tertiary'];
final error = source['error'];
final warning = source['warning'];
final disable = source['disable'];
final light = source['light'];
final lightAsFixed = source['lightAsFixed'] ?? source['light_as_fixed'];
final dark = source['dark'];
final darkAsFixed = source['darkAsFixed'] ?? source['dark_as_fixed'];
final mid = source['mid'];
final holo = source['holo'];
final soft = source['soft'];
final deep = source['deep'];
return ThemeColors(
primary: primary is Object ? primary.color : null,
secondary: secondary is Object ? secondary.color : null,
tertiary: tertiary is Object ? tertiary.color : null,
error: error is Object ? error.color : null,
warning: warning is Object ? warning.color : null,
disable: disable is Object ? disable.color : null,
light: light is Object ? light.color : null,
lightAsFixed: lightAsFixed is Object ? lightAsFixed.color : null,
dark: dark is Object ? dark.color : null,
darkAsFixed: darkAsFixed is Object ? darkAsFixed.color : null,
mid: mid is Object ? mid.color : null,
holo: holo is Object ? holo.color : null,
soft: soft is Object ? soft.color : null,
deep: deep is Object ? deep.color : null,
);
} catch (_) {
return ThemeColors();
}
}