fromJson method

  1. @override
RadiusTokenValue fromJson(
  1. Object? value
)

Implementation

@override
RadiusTokenValue fromJson(Object? value) {
  if (value is Map<String, dynamic>) {
    final topLeft = value['topLeft'];
    final topRight = value['topRight'];
    final bottomLeft = value['bottomLeft'];
    final bottomRight = value['bottomRight'];
    final smoothing = value['smoothing'];
    return RadiusTokenValue(
      smoothing: smoothing is num ? smoothing.toDouble() : 0.0,
      radius: BorderRadius.only(
        topLeft: topLeft is num
            ? Radius.circular(topLeft.toDouble())
            : Radius.zero,
        topRight: topRight is num
            ? Radius.circular(topRight.toDouble())
            : Radius.zero,
        bottomLeft: bottomLeft is num
            ? Radius.circular(bottomLeft.toDouble())
            : Radius.zero,
        bottomRight: bottomRight is num
            ? Radius.circular(bottomRight.toDouble())
            : Radius.zero,
      ),
    );
  }
  return const RadiusTokenValue(
    smoothing: 0.0,
    radius: BorderRadius.zero,
  );
}