Volume.fromJson constructor

Volume.fromJson(
  1. dynamic json
)

Implementation

factory Volume.fromJson(dynamic json) {
  if (json is String) {
    final position = int.tryParse(json);
    if (position != null) {
      return Volume.fromJsonNumber(position);
    }
  }

  if (json is int) {
    return Volume.fromJsonNumber(json);
  } else if (json is Map<String, dynamic>) {
    return Volume.fromJsonMap(json);
  } else {
    throw ArgumentError('Invalid JSON for Volume: $json');
  }
}