fromJson static method

Override fromJson(
  1. Map<String, dynamic> json
)

Implementation

static Override fromJson(Map<String, dynamic> json) {
  final override = Override(json['node'] as String);
  final properties = json['properties'] as List<dynamic>;
  for (final property in properties) {
    switch (property['property'] as String) {
      case 'child':
        override.setChild(property['value'] as Widget);
        break;
      case 'children':
        override.setChildren(property['value'] as List<Widget>);
        break;
      case 'textData':
        override.setText(property['value'] as String);
        break;
      case 'imageData':
        override.setImage(property['value'] as String);
        break;
      case 'fill':
        final fill = property['value'] as Map<String, dynamic>;
        override.setColor(Color(int.parse(fill['color'] as String, radix: 16))
            .withOpacity(fill['opacity'] as double));
        break;
      default:
        break;
    }
  }
  return override;
}