decode method
Revert an encoded map of String to json encodable
objects to an instance of T
. Return null if data
is null or conversion fails.
Implementation
@override
TextTheme? decode(Map<String, dynamic>? data) {
//```codec
const t = TextStyleCodec();
//```
if (data == null || data.isEmpty) return null;
return TextTheme(
displayLarge: t.decode(data['displayLarge']),
displayMedium: t.decode(data['displayMedium']),
displaySmall: t.decode(data['displaySmall']),
headlineLarge: t.decode(data['headlineLarge']),
headlineMedium: t.decode(data['headlineMedium']),
headlineSmall: t.decode(data['headlineSmall']),
titleLarge: t.decode(data['titleLarge']),
titleMedium: t.decode(data['titleMedium']),
titleSmall: t.decode(data['titleSmall']),
bodyLarge: t.decode(data['bodyLarge']),
bodyMedium: t.decode(data['bodyMedium']),
bodySmall: t.decode(data['bodySmall']),
labelLarge: t.decode(data['labelLarge']),
labelMedium: t.decode(data['labelMedium']),
labelSmall: t.decode(data['labelSmall']),
);
}