ExtrinsicStatus.fromJson constructor

ExtrinsicStatus.fromJson(
  1. dynamic json
)

Implementation

factory ExtrinsicStatus.fromJson(dynamic json) {
  String type;
  dynamic value;

  if (json is String) {
    type = json;
    value = null;
  } else if (json is Map<String, dynamic>) {
    type = json.keys.first;
    value = json[type];
  } else {
    throw Exception('ExtrinsicStatus: Invalid json value "$json"');
  }

  return ExtrinsicStatus(
    type: type,
    value: value,
  );
}