toJson method
Implementation
Map<String, dynamic> toJson() {
final s = _resolved;
return {
'size': s.size,
'color': s.color?.toJson(),
'opacity': s.opacity,
'bold': s.bold,
// Omitted when unset so the wire shape is unchanged for existing styles.
if (s.weight != null) 'weight': s.weight!.name,
if (s.italic != null) 'italic': s.italic,
if (s.role != null) 'role': s.role!.name,
// Carried so each generator can resolve the role without a shared table.
if (s.role != null) 'roleSwiftFont': s.role!.swiftFont,
if (s.role != null) 'roleAndroidSp': s.role!.androidSp,
};
}