fromJson static method

ModuleMetadataV13 fromJson(
  1. Map<String, dynamic> map
)

Creates Class Object from Json

Implementation

static ModuleMetadataV13 fromJson(Map<String, dynamic> map) {
  final obj = ModuleMetadataV13(
    name: map['name'],
    index: map['index'],
    constants: (map['constants'] as List)
        .map((val) => ModuleConstantMetadataV9.fromJson(val))
        .toList(growable: false),
    errors: (map['errors'] as List)
        .map((val) => ErrorMetadataV9.fromJson(val))
        .toList(growable: false),
  );

  if (map['storage'] != null &&
      map['storage'] is Option &&
      (map['storage'] as Option).value != null) {
    obj.storage = StorageMetadataV13.fromJson(map['storage'].value);
  }

  if (map['calls'] != null &&
      map['calls'] is Option &&
      (map['calls'] as Option).value != null) {
    obj.calls = (map['calls'].value as List)
        .map((val) => FunctionMetadataV9.fromJson(val))
        .toList(growable: false);
  }

  if (map['events'] != null &&
      map['events'] is Option &&
      (map['events'] as Option).value != null) {
    obj.events = (map['events'].value as List)
        .map((val) => EventMetadataV9.fromJson(val))
        .toList(growable: false);
  }
  return obj;
}