DeviceConfiguration.fromJson constructor

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

Implementation

factory DeviceConfiguration.fromJson(Map<String, dynamic> json) {
  if (json.containsKey('type')) {
    var deviceProfileType = deviceProfileTypeFromString(json['type']);
    switch (deviceProfileType) {
      case DeviceProfileType.DEFAULT:
        return DefaultDeviceConfiguration.fromJson(json);
    }
  } else {
    throw FormatException('Missing type!');
  }
}