fromMap static method
- Map<
String, dynamic> ? map, { - EnumMethod? enumMethod,
Gets a possible IOSNSAttributedString instance from a Map value.
Implementation
static IOSNSAttributedString? fromMap(
Map<String, dynamic>? map, {
EnumMethod? enumMethod,
}) {
if (map == null) {
return null;
}
final instance = IOSNSAttributedString(
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
baselineOffset: map['baselineOffset'],
expansion: map['expansion'],
foregroundColor: map['foregroundColor'] != null
? UtilColor.fromStringRepresentation(map['foregroundColor'])
: null,
kern: map['kern'],
ligature: map['ligature'],
obliqueness: map['obliqueness'],
strikethroughColor: map['strikethroughColor'] != null
? UtilColor.fromStringRepresentation(map['strikethroughColor'])
: null,
strikethroughStyle: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => IOSNSUnderlineStyle.fromNativeValue(
map['strikethroughStyle'],
),
EnumMethod.value => IOSNSUnderlineStyle.fromValue(
map['strikethroughStyle'],
),
EnumMethod.name => IOSNSUnderlineStyle.byName(
map['strikethroughStyle'],
),
},
string: map['string'],
strokeColor: map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null,
strokeWidth: map['strokeWidth'],
textEffect: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue =>
IOSNSAttributedStringTextEffectStyle.fromNativeValue(
map['textEffect'],
),
EnumMethod.value => IOSNSAttributedStringTextEffectStyle.fromValue(
map['textEffect'],
),
EnumMethod.name => IOSNSAttributedStringTextEffectStyle.byName(
map['textEffect'],
),
},
underlineColor: map['underlineColor'] != null
? UtilColor.fromStringRepresentation(map['underlineColor'])
: null,
underlineStyle: switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => IOSNSUnderlineStyle.fromNativeValue(
map['underlineStyle'],
),
EnumMethod.value => IOSNSUnderlineStyle.fromValue(
map['underlineStyle'],
),
EnumMethod.name => IOSNSUnderlineStyle.byName(map['underlineStyle']),
},
);
return instance;
}