fromJson method

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

Implementation

@override
SpacingTokenValue fromJson(Object? value) {
  if (value is Map<String, dynamic>) {
    final left = value['left'];
    final right = value['right'];
    final top = value['top'];
    final bottom = value['bottom'];
    return SpacingTokenValue(
      EdgeInsets.only(
        left: left is num ? left.toDouble() : 0.0,
        right: right is num ? right.toDouble() : 0.0,
        top: top is num ? top.toDouble() : 0.0,
        bottom: left is num ? bottom.toDouble() : 0.0,
      ),
    );
  }
  return const SpacingTokenValue(EdgeInsets.zero);
}