MatexPairTypeMetadata.fromJson constructor

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

Implementation

factory MatexPairTypeMetadata.fromJson(Map<String, dynamic> json) {
  final rawWeight = json['weight'];
  double? weight;

  if (rawWeight != null) {
    weight = double.parse(rawWeight.toString());
  }

  return MatexPairTypeMetadata(
    key: json['key'] as String,
    main: json['main'] as String,
    subKey: json['subKey'] as String?,
    sub: json['sub'] as String?,
    weight: weight ?? _kWeight,
  );
}