fromJson static method

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

Implementation

static BitSequenceCodecInterface fromJson(final Map<String, dynamic> json) {
  if (json['type'] == null || json['id'] == null) {
    throw Exception('Exception as didn\'t found the type for this json: $json');
  }
  final int id = json['id'];
  final Map<String, dynamic> typeObject = json['type'];
  final MapEntry defType = (typeObject['def'] as Map).entries.first;

  return BitSequenceCodecInterface(
    id: id,
    bitStoreType: defType.value['bit_store_type'],
    bitOrderType: defType.value['bit_order_type'],
    path: typeObject['path']?.cast<String>(),
    docs: typeObject['docs']?.cast<String>(),
  );
}