fromJson static method

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

Creates Class Object from Json

Implementation

static ModuleMetadataV11 fromJson(Map<String, dynamic> map) {
  final obj = ModuleMetadataV11(
    name: map['name'],
    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 = StorageMetadataV11.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;
}