fromJson method

  1. @override
IconTokenValue fromJson(
  1. Object? json
)

Implementation

@override
IconTokenValue fromJson(Object? json) {
  if (json is Map<String, dynamic>) {
    final paths = json['paths'];
    final size = json['size'];
    final offset = json['offset'];
    return IconTokenValue(
      paths: [
        if (paths is List<dynamic>)
          ...paths.map((path) => IconPath.fromJson(path)),
      ],
      size: const SizeConverter().fromJson(size),
      offset: const OffsetConverter().fromJson(offset),
    );
  }
  return const IconTokenValue(
    paths: <IconPath>[],
    size: Size.zero,
    offset: Offset.zero,
  );
}